From 1d4ad62f12fe06086fc42afd99670b346693f0ba Mon Sep 17 00:00:00 2001 From: Baris Sencan Date: Thu, 26 Feb 2015 16:10:50 -0800 Subject: [PATCH] Document new features --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index 8151089..b8de670 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,47 @@ So basically, *setting a normal edge's position drags the whole view along with ```swift var top: CGFloat // Top layout guide y coordinate. Read-only. +var right: CGFloat // Equal to the width of the controller's view. Read-only. For convenience. var bottom: CGFloat // Bottom layout guide y coordinate. Read-only. +var left: CGFloat // Always equal to 0. Read-only. For convenience. +``` + +###Helper Methods + +```swift +func inset(view: UIView, amount: CGFloat) -> CGRect +func inset(layer: CALayer, amount: CGFloat) -> CGRect +func inset(rect: CGRect, amount: CGFloat) -> CGRect + +func inset(view: UIView, dx: CGFloat, dy: CGFloat) -> CGRect +func inset(layer: CALayer, dx: CGFloat, dy: CGFloat) -> CGRect +func inset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect + +func inset(view: UIView, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect +func inset(layer: CALayer, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect +func inset(rect: CGRect, top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> CGRect +``` + +```swift +func offset(view: UIView, amount: CGFloat) -> CGRect +func offset(layer: CALayer, amount: CGFloat) -> CGRect +func offset(rect: CGRect, amount: CGFloat) -> CGRect + +func offset(view: UIView, dx: CGFloat, dy: CGFloat) -> CGRect +func offset(layer: CALayer, dx: CGFloat, dy: CGFloat) -> CGRect +func offset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect { +``` + +These functions never modify the view/layer/rectangle they are passed. + +###Smart Assign Operator + +The smart assign operator `=~` has only one job; to make your life easier. + +```swift +someView.origin =~ (0, 20) +anotherView.size =~ (100, 100) +yetAnotherView.frame =~ (0, 120, view.width, 100) ``` ###CALayer/UIView Methods