Skip to content

Commit 3ffca59

Browse files
authored
Add note about CocoaAction and how to get download progress
related to this conversation RxSwiftCommunity#38
1 parent 349fc1c commit 3ffca59

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ button.rx_action = action
5656

5757
Now when the button is pressed, the action is executed. The button's `enabled` state is bound to the action's `enabled` property. That means you can feed your form-validation logic into the action as a signal, and your button's enabled state is handled for you. Also, the user can't press the button again before the action is done executing, since it only handles one thing at a time. Cool. Check out [this code example of CocoaAction _in_ action](https://github.com/artsy/eidolon/blob/cb31168fa29dcc7815fd4a2e30e7c000bd1820ce/Kiosk/Bid%20Fulfillment/GenericFormValidationViewModel.swift).
5858

59+
If you'd like to use `Action` to do a complex operation such as file download with download progress report (to update progress bar in the UI for example) you'd user `Action<Void, Int>` instead of `CocoaAction`. Out of the box `CocoaAction` can't emit progress values, your own `Action<Void, Int>` will do that. For details refer to [this article](http://www.sm-cloud.com/rxswift-action/).
60+
5961
There's also a really cool extension on `UIAlertAction`, used by [`UIAlertController`](http://ashfurrow.com/blog/uialertviewcontroller-example/). One catch: because of the limitations of that class, you can't instantiate it with the normal initializer. Instead, call this class method:
6062

6163
```swift

0 commit comments

Comments
 (0)