DeviceLayout 0.5.0

DeviceLayout 0.5.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2020年4月
SPM支持 SPM

DeviceLayout 维护。



  • 作者:
  • cruisediary

DeviceLayout

logo

Carthage compatible Swift CI Status Version License Platform

**DeviceLayout** 是一个 Swift 框架,允许您为每个设备设置不同的 自动布局 约束

仅使用 Xcode 的 IBInspector 来设置每个设备大小不同的常量,无需任何代码 :)

@IBInspectable 在无需任何代码的情况下实现魔法效果

只需 3 秒钟,您就可以设置设计指南并让设计师开心🚀

public enum Size: Int, Comparable {
    case unknownSize = 0
    /// iPhone 4, 4s, iPod Touch 4th gen.
    case screen3_5Inch
    /// iPhone 5, 5s, 5c, SE, iPod Touch 5-6th gen.
    case screen4Inch
    /// iPhone 6, 6s, 7, 8
    case screen4_7Inch
    /// iPhone 6+, 6s+, 7+, 8+
    case screen5_5Inch
    /// iPhone X, Xs
    case screen5_8Inch
    /// iPhone Xr
    case screen6_1Inch
    /// iPhone Xs Max
    case screen6_5Inch
    /// iPad Mini
    case screen7_9Inch
    /// iPad
    case screen9_7Inch
    /// iPad Pro (10.5-inch)
    case screen10_5Inch
    /// iPad Pro (11-inch)
    case screen11Inch
    /// iPad Pro (12.9-inch)
    case screen12_9Inch
}

示例

第一步:将您的约束继承到 DeviceLayoutConstraint

logo

第二步:为每个设备设置自己的常量并调整您的 UI 设计指南

对照 PSDSketchZeplin UI 指南

让设计师开心 :)

logo

需求

  • iOS 8.0+
  • Swift 3+, 4+, 5+

安装

📲安装

DeviceLayout 可以通过 CocoapodsCarthage 获得

pod "DeviceLayout"

Carthage

github "cruisediary/DeviceLayout" ~> 0.5.0

依赖

  • Device - 用 Swift 编写的轻量级工具,用于检测当前设备和屏幕尺寸。

👨‍💻作者

cruz, ![email protected]

🛡许可证

DeviceLayout 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。