CombineCocoa attempts to provide publishers for common UIKit controls so you can consume user interaction as Combine emissions and compose them into meaningful, logical publisher chains.
Note: This is still a primal version of this, with much more to be desired. I gladly accept PRs, ideas, opinions, or improvements. Thank you ! :)
Check out the Example in the Example folder. Run
pod install and open the workspace to try it out.
import Combine import CombineCocoa textField.textPublisher // AnyPublisher<String, Never> segmented.selectedSegmentIndexPublisher // AnyPublisher<Int, Never> slider.valuePublisher // AnyPublisher<Float, Never> button.tapPublisher // AnyPublisher<Void, Never> swtch.isOnPublisher // AnyPublisher<Bool, Never> stepper.valuePublisher // AnyPublisher<Double, Never> datePicker.datePublisher // AnyPublisher<Date, Never> refreshControl.isRefreshingPublisher // AnyPublisher<Bool, Never> pageControl.currentPagePublisher // AnyPublisher<Int, Never>
Add the following line to your Podfile:
Swift Package Manager
Add the following dependency to your Package.swift file:
.package(url: "https://github.com/freak4pc/CombineCocoa.git", from: "0.0.1")
Carthage support is offered as a prebuilt binary.
Add the following to your Cartfile:
- Support non
UIControl.Event-based publishers (e.g. delegates).
- ... your ideas? :)
- CombineCocoa is highly inspired by RxSwift's RxCocoa in its essence, kudos to Krunoslav Zaher for all of his amazing work on this.
- Thanks to Antoine van der Lee for his tutorial on Creating Custom Publishers. The idea to set up a control target inside the publisher was inspired by it.
MIT, of course ;-) See the LICENSE file.
The Apple logo and the Combine framework are property of Apple Inc.