Streams of values over time
Swift Shell Other
Latest commit 9795bb7 Feb 19, 2017 @andersio andersio committed on GitHub Merge pull request #3396 from alper/patch-1
Correctly initialize the submodules
Permalink
Failed to load latest commit information.
Carthage/Checkouts Update ReactiveSwift to 1.0.0 Jan 2, 2017
Documentation Fix #selector usage in README and docs Feb 9, 2017
Logo Update the README layout to match ReactiveSwift. Dec 31, 2016
ReactiveCocoa-iOS.playground Correctly initialize the submodules Feb 8, 2017
ReactiveCocoa-macOS.playground Added parameter to the other documentation as well. Feb 9, 2017
ReactiveCocoa-tvOS.playground Added parameter to the other documentation as well. Feb 9, 2017
ReactiveCocoa.xcodeproj Add UIPickerView reactive extensions Feb 7, 2017
ReactiveCocoa.xcworkspace Added a playground for tvOS. Nov 21, 2016
ReactiveCocoa Represent selection with a named tuple Feb 9, 2017
ReactiveCocoaTests Represent selection with a named tuple Feb 9, 2017
script Get the SDK root and pass it to the Swift compiler. Nov 22, 2016
.gitignore Add support for Swift Package Manager Aug 12, 2016
.gitmodules Depend on ReactiveSwift through Carthage Sep 11, 2016
.swift-version Update .swift-version to 3.0 Sep 24, 2016
.travis.yml Force CI to use iOS 10.2 Simulator. Dec 16, 2016
CHANGELOG.md Fix #selector usage in README and docs Feb 9, 2017
CONTRIBUTING.md Updated Contributing file May 6, 2016
Cartfile 5.0.0-alpha.6 Dec 22, 2016
Cartfile.private Update Quick to v1.0.0 Nov 25, 2016
Cartfile.resolved Update ReactiveSwift to 1.0.0 Jan 2, 2017
LICENSE.md Update LICENSE.md Feb 7, 2016
README.md Fix #selector usage in README and docs Feb 9, 2017
ReactiveCocoa.podspec 5.0.0 Jan 16, 2017

README.md

ReactiveCocoa

Reactive extensions to Cocoa frameworks, built on top of ReactiveSwift.

Join the ReactiveSwift Slack community.


Carthage compatible CocoaPods compatible GitHub release Swift 3.0.x platforms

⚠️ Looking for the Objective-C API? ⚠️ Still using Swift 2.x?

🎉 Migrating from RAC 4.x?

🚄 Release Roadmap

What is 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.

What is ReactiveCocoa?

ReactiveCocoa wraps various aspects of Cocoa frameworks with the declarative ReactiveSwift primitives.

  1. UI Bindings

    UI components expose BindingTargets, which accept bindings from any kind of streams of values via the <~ operator.

    // Bind the `name` property of `person` to the text value of an `UILabel`.
    nameLabel.reactive.text <~ person.name

    Note: You'll need to import ReactiveSwift as well to make use of the <~ operator.

  2. Controls and User Interactions

    Interactive UI components expose Signals for control events and updates in the control value upon user interactions.

    A selected set of controls provide a convenience, expressive binding API for Actions.

    // Update `allowsCookies` whenever the toggle is flipped.
    preferences.allowsCookies <~ toggle.reactive.isOnValues
    
    // Compute live character counts from the continuous stream of user initiated
    // changes in the text.
    textField.reactive.continuousTextValues.map { $0.characters.count }
    
    // Trigger `commit` whenever the button is pressed.
    button.reactive.pressed = CocoaAction(viewModel.commit)
  3. 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 `object`.
    object.reactive.lifetime.ended.observeCompleted(doCleanup)
  4. Expressive, Safe Key Path Observation

    Establish key-value observations in the form of SignalProducers and 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.values(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<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.

Getting started

ReactiveCocoa supports macOS 10.9+, iOS 8.0+, watchOS 2.0+, and tvOS 9.0+.

Carthage

If you use Carthage to manage your dependencies, simply add ReactiveCocoa to your Cartfile:

github "ReactiveCocoa/ReactiveCocoa" ~> 5.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.

CocoaPods

If you use CocoaPods to manage your dependencies, simply add ReactiveCocoa to your Podfile:

pod 'ReactiveCocoa', '~> 5.0.0'

Git submodule

  1. Add the ReactiveCocoa repository as a submodule of your application’s repository.
  2. Run git submodule update --init --recursive from within the ReactiveCocoa folder.
  3. Drag and drop ReactiveCocoa.xcodeproj, Carthage/Checkouts/ReactiveSwift/ReactiveSwift.xcodeproj, and Carthage/Checkouts/Result/Result.xcodeproj into your application’s Xcode project or workspace.
  4. On the “General” tab of your application target’s settings, add ReactiveCocoa.framework, ReactiveSwift.framework, and Result.framework to the “Embedded Binaries” section.
  5. If your application target does not contain Swift code at all, you should also set the EMBEDDED_CONTENT_CONTAINS_SWIFT build setting to “Yes”.

Have a question?

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.

Release Roadmap

Current Stable Release:
GitHub release

ReactiveCocoa 6.0

It targets Swift 3.1.x and ReactiveSwift 2.0. The estimated schedule is Spring 2017.

Since ReactiveSwift 2.0 would contain breaking changes, the public API of ReactiveCocoa is considered breaking too.

As resilience would be enforced in Swift 4.0, it is important for us to have a clean and steady API to start with. The expectation is to have the API reviewing to be concluded in ReactiveCocoa 6.0, before we move on to ReactiveSwift 3.0 and Swift 4.0. Any contribution to help realising this goal is welcomed.

ReactiveCocoa 7.0

It targets Swift 4.0.x and ReactiveSwift 3.0. The estimated schedule is late 2017.

The release may contain breaking changes due to changes in ReactiveSwift 3.0.

ReactiveCocoa 7.0 would focus on three main goals:

  1. Swift 4.0 Resilience
  2. Migration to ReactiveSwift 3.0
  3. Support new features introduced to AppKit, UIKit and Swift.