Easy access to UIView & CALayer's layout written in Swift (Inspired from FrameAccessor).
$ pod 'Brief'
Just add Brief.swift or Brief-OSX.swift into your project.
// 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
/NSView
properties:
Property | Type | Аvailability |
---|---|---|
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
properties:
Property | Type | Аvailability |
---|---|---|
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 |
Following properties are useless in Swift and removed.
UIView
frameOrigin
,frameSize
centerX
,centerY
middlePoint
,middleX
,middleY
UIScrollView
- All properties
CALayer
frameOrigin
,frameSize
anchorX
,anchorY
positionX
,positionY
Apache 2.0 License