Contains replacements for the RAC and RACObserve macros in Swift and adds multiple cast methods.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example
Pod/Classes
.gitignore
.travis.yml
ALReactiveCocoaExtension.podspec
Changelog.md
LICENSE
README.md
_Pods.xcodeproj

README.md

ALReactiveCocoaExtension

Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

The pod includes extensions for SignalProducer.

SignalProducer extension

This pod includes an extension for the new SignalProducer. This brings the methods we're familiar with from earlier versions of ReactiveCocoa.

let producer = SignalProducer<String, NSError>(value: "testValue")
    
// Prints "producer started!"
producer.onStarting { () -> () in
    print("producer started!")
}.start()
    
// Prints "testValue"
producer.onNext { (object) -> () in
    print(object)
}.start()
    
// Prints "testValue", can be used to cast AnyObjects for example
producer.onNextAs { (string:String) -> () in
    print(string)
}.start()
    
// Prints "testValue", can be used to cast AnyObjects for example
producer.startWithNextAs { (string:String) -> () in
    print(string)
}
    
// Prints "Error Domain=sample.domain Code=-1 "(null)""
let errorProducer = SignalProducer<String, NSError>(error:NSError(domain: "sample.domain", code: -1, userInfo: nil))
errorProducer.onError { (error) -> () in
    print(error)
}.start()

Requirements

  • This pod requires ReactiveCocoa 5.0.0 and up
  • Swift 3.0
  • iOS 8+
  • tvOS 9+
  • watchOS 2+

Installation

ALReactiveCocoaExtension is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ALReactiveCocoaExtension"

Swift version vs Pod version

Swift version Pod version
3.X >= 4.0.0
2.3 3.0.3

Author

Antoine van der Lee, https://twitter.com/twannl https://www.avanderlee.com

License

ALReactiveCocoaExtension is available under the MIT license. See the LICENSE file for more info.