Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.
Reactive extensions to Cocoa frameworks, built on top of ReactiveSwift.
ReactiveSwift offers composable, declarative and flexible primitives that are built around the grand concept of streams of values over time. These primitives can be used to uniformly represent common Cocoa and generic programming patterns that are fundamentally an act of observation.
For more information about the core primitives, see ReactiveSwift.
ReactiveCocoa wraps various aspects of Cocoa frameworks with the declarative ReactiveSwift primitives.
operator.// Bind the `name` property of `person` to the text value of an `UILabel`. nameLabel.reactive.text
Note: You'll need to import ReactiveSwift as well to make use of theoperator.
Controls and User Interactions
// Update `allowsCookies` whenever the toggle is flipped. preferences.allowsCookies
Declarative Objective-C Dynamism
Create signals that are sourced by intercepting Objective-C objects, e.g. method call interception and object deinitialization.
// Notify after every time `viewWillAppear(_:)` is called. let appearing = viewController.reactive.trigger(for: #selector(UIViewController.viewWillAppear(_:)))
// Observe the lifetime of
Expressive, Safe Key Path Observation
DynamicPropertys, and enjoy the inherited composability.
// A producer that sends the current value of `keyPath`, followed by // subsequent changes. // // Terminate the KVO observation if the lifetime of `self` ends. let producer = object.reactive.producer(forKeyPath: #keyPath(key)) .take(during: self.reactive.lifetime)
// A parameterized property that represents the supplied key path of the // wrapped object. It holds a weak reference to the wrapped object. let property = DynamicProperty(object: person, keyPath: #keyPath(person.name))
But there are still more to be discovered and introduced. Read our in-code documentations and release notes to find out more.
ReactiveCocoa supports macOS 10.9+, iOS 8.0+, watchOS 2.0+, and tvOS 9.0+.
If you use Carthage to manage your dependencies, simply add ReactiveCocoa to your
github "ReactiveCocoa/ReactiveCocoa" ~> 10.1
If you use Carthage to build your dependencies, make sure you have added
ReactiveSwift.frameworkto the "Linked Frameworks and Libraries" section of your target, and have included them in your Carthage framework copying build phase.
If you use CocoaPods to manage your dependencies, simply add ReactiveCocoa to your
pod 'ReactiveCocoa', '~> 10.1'
If you use Swift Package Manager, simply add ReactiveCocoa as a dependency of your package in
.package(url: "https://github.com/ReactiveCocoa/ReactiveCocoa.git", branch: "master")
git submodule update --init --recursivefrom within the ReactiveCocoa folder.
Carthage/Checkouts/ReactiveSwift/ReactiveSwift.xcodeprojinto your application’s Xcode project or workspace.
ReactiveSwift.frameworkto the “Embedded Binaries” section.
EMBEDDED_CONTENT_CONTAINS_SWIFTbuild setting to “Yes”.
ReactiveCocoa is expected to declare library ABI stability when Swift rolls out resilience support in Swift 5. Until then, ReactiveCocoa will incrementally adopt new language features.