Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashfurrow/racalertaction
UIAlertAction subclass with support for ReactiveCocoa
https://github.com/ashfurrow/racalertaction
Last synced: 2 months ago
JSON representation
UIAlertAction subclass with support for ReactiveCocoa
- Host: GitHub
- URL: https://github.com/ashfurrow/racalertaction
- Owner: ashfurrow
- License: mit
- Created: 2015-02-26T17:59:13.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-27T18:26:23.000Z (almost 10 years ago)
- Last Synced: 2024-10-07T20:46:17.960Z (3 months ago)
- Language: Objective-C
- Size: 170 KB
- Stars: 13
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RACAlertAction
UIAlertAction subclass with support for ReactiveCocoa.## Purpose
iOS 8 introduced `UIAlertController`, an abstraction above and replacement
for `UIAlertView`. `UIAlertController` uses `UIAlertAction` instances
to represent buttons (and actions for those buttons). But the interface
doesn't lend itself to naturally fit in the ReactiveCocoa worldInstead, we need to subclass it to ensure that certain things are set
at initialization time. That's what this library does.## Installation
Installation is easy via CocoaPods. In your Podfile:
```ruby
pod 'RACAlertAction'
```If you want a specific version of ReactiveCocoa, specify it on a separate line. `pod install`, then `import` the library via `#import ` or `@import RACAlertAction;` if you're using frameworks.
## Usage
Usage is pretty straightforward.
```objc
UIAlertController *alertController = ... // Set up your controller as you would normally.// Create, then add the action
RACAlertAction *alertAction = [RACAlertAction actionWithTitle:/* your title */ style:/* whatever style */];
[alertController addAction:alertAction];alertAction.command = ... // Whatever RACCommand that represents your unit of work.
```The action's `enabled` property will be automatically bound to the `enabled` signal of its `rac_command`.