Name: ReactiveCocoa
Owner: ReactiveCocoa
Description: Streams of values over time
Created: 2012-03-02 22:11:24.0
Updated: 2018-01-19 03:16:13.0
Pushed: 2018-01-13 16:21:53.0
Size: 16865
Language: Swift
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Reactive extensions to Cocoa frameworks, built on top of ReactiveSwift.
?? Looking for the Objective-C API?
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.
UI Bindings
UI components expose BindingTarget
s, which accept bindings from any
kind of streams of values via the <~
operator.
ind the `name` property of `person` to the text value of an `UILabel`.
Label.reactive.text <~ person.name
Note: You'll need to import ReactiveSwift as well to make use of the <~
operator.
Controls and User Interactions
Interactive UI components expose Signal
s for control events
and updates in the control value upon user interactions.
A selected set of controls provide a convenience, expressive binding
API for Action
s.
pdate `allowsCookies` whenever the toggle is flipped.
erences.allowsCookies <~ toggle.reactive.isOnValues
ompute live character counts from the continuous stream of user initiated
hanges in the text.
Field.reactive.continuousTextValues.map { $0.characters.count }
rigger `commit` whenever the button is pressed.
on.reactive.pressed = CocoaAction(viewModel.commit)
Declarative Objective-C Dynamism
Create signals that are sourced by intercepting Objective-C objects, e.g. method call interception and object deinitialization.
otify after every time `viewWillAppear(_:)` is called.
appearing = viewController.reactive.trigger(for: #selector(UIViewController.viewWillAppear(_:)))
bserve the lifetime of `object`.
ct.reactive.lifetime.ended.observeCompleted(doCleanup)
Expressive, Safe Key Path Observation
Establish key-value observations in the form of SignalProducer
s and
DynamicProperty
s, and enjoy the inherited composability.
producer that sends the current value of `keyPath`, followed by
ubsequent changes.
erminate the KVO observation if the lifetime of `self` ends.
producer = object.reactive.values(forKeyPath: #keyPath(key))
.take(during: self.reactive.lifetime)
parameterized property that represents the supplied key path of the
rapped object. It holds a weak reference to the wrapped object.
property = DynamicProperty<String>(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 Cartfile
:
ub "ReactiveCocoa/ReactiveCocoa" ~> 7.0
If you use Carthage to build your dependencies, make sure you have added ReactiveCocoa.framework
, ReactiveSwift.framework
, and Result.framework
to 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 Podfile
:
'ReactiveCocoa', '~> 7.0'
git submodule update --init --recursive
from within the ReactiveCocoa folder.ReactiveCocoa.xcodeproj
,
Carthage/Checkouts/ReactiveSwift/ReactiveSwift.xcodeproj
, and
Carthage/Checkouts/Result/Result.xcodeproj
into your application?s Xcode
project or workspace.ReactiveCocoa.framework
, ReactiveSwift.framework
, and Result.framework
to the ?Embedded Binaries? section.EMBEDDED_CONTENT_CONTAINS_SWIFT
build setting to ?Yes?.If you need any help, please visit our GitHub issues or Stack Overflow. Feel free to file an issue if you do not manage to find any solution from the archives.
ReactiveCocoa is expected to declare library ABI stability when Swift rolls out resilence support in Swift 5. Until then, ReactiveCocoa will incrementally adopt new language features.