WWLayout 0.8.2

WWLayout 0.8.2

Steven GrosmarkSteven GrosmarkSteven Grosmark 维护。



WWLayout 0.8.2

  • Steven Grosmark

WWLayout

WWLayout

易于编写自动布局约束,对标准命名空间进行了最小扩展。

特性亮点

  • 易于使用、可读的 API
  • 向后兼容(即 iOS 11 之前)安全区域约束
  • 将约束标记到标签中,以便轻松切换不同的布局(即将推出)
  • 根据大小类自动切换约束(即将推出)

简介

使用视图的 layout 属性添加约束到视图,如下所示

    myView.layout.width(400)

通过链式调用轻松添加多个约束

    myView.layout.width(400).height(200)

一个更复杂的例子

    let container = UIView()
    let child = UIView()

    container.layout.fill(.safeArea)

    child.layout
      .fill(container, axis: .x, inset: 20)
      .center(in: container, axis: .y, priority: .high)
      .top(.lessOrEqual, to: container, offset: 100)
      .height(toWidth: 0.5)

文档

在此处找到文档

安装

Swift包管理器

WWLayout包的URL是

https://github.com/ww-tech/wwlayout.git

使用文件 -> Swift Packages -> 添加包依赖...菜单项添加包依赖到您的Xcode项目中。

CocoaPods

只需将WWLayout添加到您的Podfile

  pod 'WWLayout'

贡献

作者

授权

WWLayout 由 WW 国际公司 © 版权所有。

WWLayout 遵循 Apache-2.0 开源许可证授权。