Skip to content

Commit 1d4ad62

Browse files
author
Baris Sencan
committed
Document new features
1 parent 5fd25f1 commit 1d4ad62

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,47 @@ So basically, *setting a normal edge's position drags the whole view along with
6666

6767
```swift
6868
var top: CGFloat // Top layout guide y coordinate. Read-only.
69+
var right: CGFloat // Equal to the width of the controller's view. Read-only. For convenience.
6970
var bottom: CGFloat // Bottom layout guide y coordinate. Read-only.
71+
var left: CGFloat // Always equal to 0. Read-only. For convenience.
72+
```
73+
74+
###Helper Methods
75+
76+
```swift
77+
func inset(view: UIView, amount: CGFloat) -> CGRect
78+
func inset(layer: CALayer, amount: CGFloat) -> CGRect
79+
func inset(rect: CGRect, amount: CGFloat) -> CGRect
80+
81+
func inset(view: UIView, dx: CGFloat, dy: CGFloat) -> CGRect
82+
func inset(layer: CALayer, dx: CGFloat, dy: CGFloat) -> CGRect
83+
func inset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect
84+
85+
func inset(view: UIView, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect
86+
func inset(layer: CALayer, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect
87+
func inset(rect: CGRect, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect
88+
```
89+
90+
```swift
91+
func offset(view: UIView, amount: CGFloat) -> CGRect
92+
func offset(layer: CALayer, amount: CGFloat) -> CGRect
93+
func offset(rect: CGRect, amount: CGFloat) -> CGRect
94+
95+
func offset(view: UIView, dx: CGFloat, dy: CGFloat) -> CGRect
96+
func offset(layer: CALayer, dx: CGFloat, dy: CGFloat) -> CGRect
97+
func offset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect {
98+
```
99+
100+
These functions never modify the view/layer/rectangle they are passed.
101+
102+
###Smart Assign Operator
103+
104+
The smart assign operator `=~` has only one job; to make your life easier.
105+
106+
```swift
107+
someView.origin =~ (0, 20)
108+
anotherView.size =~ (100, 100)
109+
yetAnotherView.frame =~ (0, 120, view.width, 100)
70110
```
71111

72112
###CALayer/UIView Methods

0 commit comments

Comments
 (0)