From 4c9de82dc0490874dfa0712a531f9b9167be2abb Mon Sep 17 00:00:00 2001 From: Robert Payne Date: Sun, 12 Apr 2015 22:36:02 +1200 Subject: [PATCH] Updated readme --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 05801cd..29f3e7c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# Snap + + + +==== [![Build Status](https://travis-ci.org/Masonry/Snap.svg)](https://travis-ci.org/Masonry/Snap) @@ -32,7 +35,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! -pod 'Snap', '~> 0.9.1' +pod 'Snap', '~> 0.9.2' ``` Then, run the following command: @@ -54,8 +57,8 @@ $ brew install carthage To integrate Snap into your Xcode project using Carthage, specify it in your `Cartfile`: -```ogdl -github "Masonry/Snap" >= 0.9.1 +``` +github "Masonry/Snap" >= 0.9.2 ``` ### Manually @@ -141,19 +144,18 @@ Heres the same constraints created using ConstraintMaker ```swift let padding = UIEdgeInsetsMake(10, 10, 10, 10) -view1.snp_makeConstraints { make in - make.top.equalTo(superview.snp_top).with.offset(padding.top) // with is an optional semantic filler - make.left.equalTo(superview.snp_left).with.offset(padding.left) - make.bottom.equalTo(superview.snp_bottom).with.offset(-padding.bottom) - make.right.equalTo(superview.snp_right).with.offset(-padding.right) +view1.snp_makeConstraints { (make) -> Void in + make.top.equalTo(superview.snp_top).offset(padding.top) + make.left.equalTo(superview.snp_left).offset(padding.left) + make.bottom.equalTo(superview.snp_bottom).offset(-padding.bottom) + make.right.equalTo(superview.snp_right).offset(-padding.right) } ``` Or even shorter ```swift -view1.snp_makeConstraints { make in - make.edges.equalTo(superview).with.insets(padding) - return // this return is a fix for implicit returns in Swift and is only required for single line constraints +view1.snp_makeConstraints { (make) -> Void in + make.edges.equalTo(superview).insets(padding) } ``` @@ -304,7 +306,7 @@ var topConstraint: Constraint? = nil // when making constraints view1.snp_makeConstraints { make in - self.topConstraint = make.top.equalTo(superview).with.offset(padding.top) + self.topConstraint = make.top.equalTo(superview).with.offset(padding.top).constraint make.left.equalTo(superview).with.offset(padding.left) }