From b13f23fe626ce5c44206d30c2e582800c1f47ea1 Mon Sep 17 00:00:00 2001 From: Suyeol Jeon Date: Fri, 25 Dec 2015 03:22:06 +0900 Subject: [PATCH] Update README.md --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 07d9217..e65ae12 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Then At a Glance ----------- -Initialize UILabel **then** setting its properties. +Initialize UILabel **then** set its properties. ```swift let label = UILabel().then { @@ -33,15 +33,21 @@ let label: UILabel = { }() ``` -#### Not prefer using `$0`? +You can use `then()` to all of `NSObject` subclasses. -Give it a name. (e.g. `this`) +```swift +let queue = NSOperationQueue().then { + $0.maxConcurrentOperationCount = 1 +} +``` + +Want to use with your own classes? Just make extensions. ```swift -let label = UILabel().then { this in - this.textAlignment = .Center - this.textColor = .blackColor() - this.text = "Hello, World!" +extension MyClass: Then {} + +let instance = MyClass().then { + $0.really = "awesome!" } ``` @@ -49,7 +55,7 @@ let label = UILabel().then { this in Real World Example ------------------ -Exmaple usage in an UIViewController subclass. +Here's an exmaple usage in an UIViewController subclass. ```swift final class MyViewController: UIViewController {