# CombineCocoa **Repository Path**: R2Jinx/CombineCocoa ## Basic Information - **Project Name**: CombineCocoa - **Description**: CombineCocoa - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: dependabot/bundler/cocoapods-downloader-1.6.3 - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-09-28 - **Last Updated**: 2022-09-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CombineCocoa



Build Status
CombineCocoa supports CocoaPods CombineCocoa supports Swift Package Manager (SPM) CombineCocoa supports Carthage

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 ! :) ## Basic Examples Check out the [Example in the **Example** folder](https://github.com/freak4pc/CombineCocoa/blob/main/Example/Example/ControlsViewController.swift#L27). Open the project in Xcode 11 and Swift Package Manager should automatically resolve the required dependencies.

## Usage tl;dr: ```swift import Combine import CombineCocoa textField.textPublisher // AnyPublisher segmented.selectedSegmentIndexPublisher // AnyPublisher slider.valuePublisher // AnyPublisher button.tapPublisher // AnyPublisher barButtonItem.tapPublisher // AnyPublisher switch.isOnPublisher // AnyPublisher stepper.valuePublisher // AnyPublisher datePicker.datePublisher // AnyPublisher refreshControl.isRefreshingPublisher // AnyPublisher pageControl.currentPagePublisher // AnyPublisher tapGesture.tapPublisher // AnyPublisher pinchGesture.pinchPublisher // AnyPublisher rotationGesture.rotationPublisher // AnyPublisher swipeGesture.swipePublisher // AnyPublisher panGesture.panPublisher // AnyPublisher screenEdgePanGesture.screenEdgePanPublisher // AnyPublisher longPressGesture.longPressPublisher // AnyPublisher scrollView.contentOffsetPublisher // AnyPublisher scrollView.reachedBottomPublisher(offset:) // AnyPublisher ``` ## Installation ### CocoaPods Add the following line to your **Podfile**: ```rb pod 'CombineCocoa' ``` ### Swift Package Manager Add the following dependency to your **Package.swift** file: ```swift .package(url: "https://github.com/CombineCommunity/CombineCocoa.git", from: "0.2.1") ``` ### Carthage Add the following to your **Cartfile**: ``` github "CombineCommunity/CombineCocoa" ``` ## Future ideas * Support non `UIControl.Event`-based publishers (e.g. delegates). * ... your ideas? :) ## Acknowledgments * CombineCocoa is highly inspired by RxSwift's [RxCocoa](https://github.com/ReactiveX/RxSwift) in its essence, kudos to [Krunoslav Zaher](https://twitter.com/KrunoslavZaher) for all of his amazing work on this. * Thanks to [Antoine van der Lee](https://twitter.com/twannl) for his tutorial on [Creating Custom Publishers](https://www.avanderlee.com/swift/custom-combine-publisher/). The idea to set up a control target inside the publisher was inspired by it. ## License MIT, of course ;-) See the [LICENSE](LICENSE) file. The Apple logo and the Combine framework are property of Apple Inc.