简介 0.1.0

简介 0.1.0

测试已测试
语言语言 SwiftSwift
许可证 Apache 2
发布最新版本2015年9月
SPM支持 SPM

kakajika 维护。



简介 0.1.0

  • kakajika

Brief

轻松访问用 Swift 编写的 UIView 和 CALayer 的布局(灵感来自 FrameAccessor)。

安装

或手动

只需将 Brief.swift 添加到您的项目中。

使用方法

// Before
view.frame.origin.x = 20.0
view.frame.size.width = 200.0
view.frame.origin.y = 100.0 - view.frame.size.height // Make view's bottom to 100.0

// After 
view.x = 20.0
view.width = 200.0
view.bottom = 100.0

支持属性

UIView 属性

属性 类型 可选项
x, y CGFloat get/set
width, height CGFloat get/set
top, left, bottom, right CGFloat get/set
boundsWidth, boundsHeight CGFloat get/set
boundsTop, boundsLeft, boundsBottom, boundsRight CGFloat get/set

CALayer 属性

属性 类型 可选项
x, y CGFloat get/set
width, height CGFloat get/set
top, left, bottom, right CGFloat get/set
boundsWidth, boundsHeight CGFloat get/set
boundsTop, boundsLeft, boundsBottom, boundsRight CGFloat get/set

已弃用

以下属性在 Swift 中已无用且已移除。

UIView

  • frameOrigin, frameSize
  • centerX, centerY
  • middlePoint, middleX, middleY

UIScrollView

  • 所有属性

CALayer

  • frameOrigin, frameSize
  • anchorX, anchorY
  • positionX, positionY

待办

  • 支持 macOS

许可证

Apache 2.0 许可协议