Giter VIP home page Giter VIP logo

reactiveobjcbridge's Introduction

ReactiveCocoa

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

Join the ReactiveSwift Slack community.


Carthage compatible CocoaPods compatible SwiftPM compatible GitHub release Swift 5.1 platforms

⚠️ Looking for the Objective-C API?

🎉 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.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<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" ~> 10.1

If you use Carthage to build your dependencies, make sure you have added ReactiveCocoa.framework and ReactiveSwift.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', '~> 10.1'

Swift Package Manager

If you use Swift Package Manager, simply add ReactiveCocoa as a dependency of your package in Package.swift:

.package(url: "https://github.com/ReactiveCocoa/ReactiveCocoa.git", branch: "master")

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 and Carthage/Checkouts/ReactiveSwift/ReactiveSwift.xcodeproj into your application’s Xcode project or workspace.
  4. On the “General” tab of your application target’s settings, add ReactiveCocoa.framework and ReactiveSwift.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

In Development

Plan of Record

ABI stability release

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.

reactiveobjcbridge's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactiveobjcbridge's Issues

Ready for a release yet?

I'm going through some of my Cartfiles and noticed that this repo still doesn't have a release tag set yet. Is there anything that we're waiting on before throwing a 1.0.0 on this?

how to "value" parameter in ResultExtensions.swift of ReactiveSwift folder

I use the "ReactiveObjCBridge" master branch to pod install. But Recently, I just pod install without modify any version (still use master), found that the "value" parameter is changed to internal, so that I can not use it anymore. Could you please help to share what can I do then ?

Here is the old code sample:
guard let value = event.value else { return }

Any idea for this ? Thanks a lot.

carthage update fails

carthage update fails on Xcode10.2.

ReactiveSwift/Sources/Scheduler.swift:187:18: error: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'DispatchSourceTimerWrapper' to 'Hashable' by implementing 'hash(into:)' instead
        fileprivate var hashValue: Int {
                        ^

** ARCHIVE FAILED **

Probably need ReactiveSwift 5.0 dependency.

Add support for bridging tuples to/from generic RACTuples

I'm not sure how useful this would end up being nor how much can actually be done given the constraints involved (such as the impossibility to know at runtime how many elements a Swift tuple holds, etc.).

However, I thought I'd have a look to see what could be done. If I finish anything that looks reasonable, I'll create a pull request.

Being able to bridge a RACTwoTuple<NSString, NSNumber> into (NSString, NSNumber) would be quite useful. For instance when we have bridged our RACSignal<RACTwoTuple<NSString, NSNumber>> (do we actually retain nested types like this? I'm not sure) to a SignalProducer<RACTwoTuple<NSString, NSNumber>, NSError>, it'd make it easy to map that to get a SignalProducer<(NSString, NSNumber), NSError>.

Being able to turn a (String, Bool) into a RACTwoTuple<NSString, NSNumber> would also be useful when bridging to RACSignal.

Can't use as static library

With cocoapods 1.5.2 I am getting the error:


The Swift pod `ReactiveObjCBridge` depends upon `ReactiveObjC`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.```

ReactiveObjCBridge errors on Swift master; possibly add this repo to Swift source compat suite?

Hi there! A recent regression makes this repo fails to type check on Swift master: https://bugs.swift.org/browse/SR-7341. It's still not fixed, and it's unclear whether or not this will be fixed. I suppose this is more of a PSA, but there are some possible next steps:

  1. Change the name of one of the isEnabled properties in question (not ideal).
  2. If you feel so inclined, contribute a patch to Swift that fixes the regression or help find someone who can do so.
  3. Figure out how to add this repo to https://github.com/apple/swift-source-compat-suite

This last step would help both prevent issues and the future and raise more awareness about the current issue. Given the dependencies in this repo, I think a separate repo would need to be opened by the maintainers (part of the "Have maintainers who will commit to resolve issues in a timely manner" requirement of that suite) that includes all of the dependencies in a single project.

Thanks for your time and consideration!

`RACsignal.toSignalProducer()` unavailable

The README.md reads:

“Hot” RACSignals cannot be directly converted into Signals, because any RACSignal subscription could potentially involve side effects. To obtain a Signal, use RACSignal.toSignalProducer followed by SignalProducer.start, which will make those potential side effects explicit.

I have an instance of RACSignal due to a mixed-language project. Looking through XCode's auto-completion suggestions, I'm not seeing anything like toSignalProducer.

Could I get a code example of how to turn a RACSignal back to Signal?

Thanks!

Cocoa pods spec has not been updated

Hello. The released version contains outdated podspec files, as far as CocoaPods do not know anything about version 5.0.0: the master repo still refers to 4.0.0 version. It would be great to have both up-to-date

Xcode 10 broken

extension Action { fileprivate var isEnabled: RACSignal<NSNumber> { return self.isEnabled.producer.map { $0 as NSNumber }.bridged } }

Gives error: Value of type 'RACSignal<NSNumber>' has no member 'producer'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.