diff --git a/README.md b/README.md index c48c83a..ef12f1c 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,21 @@ func propertySink(sink: S)(signal: Signal) -> P func propertySink(sink: S)(producer: SignalProducer) -> PropertyOf ``` +## UIKit Extensions + +##### `UIButton.rex_pressed` + +Flexible way to bind `CocoaAction` to the press of button. In addition the button will be disabled during the `Action` executing. Such behavior is convenient for tasks that require some time, like a download process in the example below. + +```swift +let downloadAction = Action { _ in + let url = NSURL(string: "https://github.com/neilpa/Rex/archive/master.zip") + let request = NSURLRequest(URL: url!) + return NSURLSession.sharedSession().rac_dataWithRequest(request).map { $0.0 } +} + +downloadButton.rex_pressed.value = downloadAction.unsafeCocoaAction +``` ## License Rex is released under the [MIT license](LICENSE)