Swiftpack.co - Package - CombineCommunity/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. Open the project in Xcode 11 and Swift Package Manager should automatically resolve the required dependencies.



import Combine
import CombineCocoa

textField.textPublisher // AnyPublisher<String, Never>
segmented.selectedSegmentIndexPublisher // AnyPublisher<Int, Never>
slider.valuePublisher // AnyPublisher<Float, Never>
button.tapPublisher // AnyPublisher<Void, Never>
barButtonItem.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>
tapGesture.tapPublisher // AnyPublisher<UITapGestureRecognizer, Never>
pinchGesture.pinchPublisher // AnyPublisher<UIPinchGestureRecognizer, Never>
rotationGesture.rotationPublisher // AnyPublisher<UIRotationGestureRecognizer, Never>
swipeGesture.swipePublisher // AnyPublisher<UISwipeGestureRecognizer, Never>
panGesture.panPublisher // AnyPublisher<UIPanGestureRecognizer, Never>
screenEdgePanGesture.screenEdgePanPublisher // AnyPublisher<UIScreenEdgePanGestureRecognizer, Never>
longPressGesture.longPressPublisher // AnyPublisher<UILongPressGestureRecognizer, Never>
scrollView.contentOffsetPublisher // AnyPublisher<CGPoint, Never>
scrollView.reachedBottomPublisher(offset:) // AnyPublisher<Void, Never>



Add the following line to your Podfile:

pod 'CombineCocoa'

Swift Package Manager

Add the following dependency to your Package.swift file:

.package(url: "https://github.com/CombineCommunity/CombineCocoa.git", from: "0.1.0")


Carthage support is offered as a prebuilt binary.

Add the following to your Cartfile:

github "CombineCommunity/CombineCocoa"

Future ideas

  • Support non UIControl.Event-based publishers (e.g. delegates).
  • ... your ideas? :)



MIT, of course ;-) See the LICENSE file.

The Apple logo and the Combine framework are property of Apple Inc.


Stars: 508


Used By

Total: 0


0.1.0 - 2019-08-14 18:07:57

A new release is upon us ! 🎉

  • CombineCocoa can now provides publishers for ControlTarget-based controls using the new ControlTarget publisher.

  • UIBarButtonItem.tapPublisher added

  • All UIGestureRecognizers added:

    • UITapGestureRecognizer.tapPublisher
    • UIPinchGestureRecognizer.pinchPublisher
    • UIRotationGestureRecognizer.rotationPublisher
    • UISwipeGestureRecognizer.swipePublisher
    • UIPanGestureRecognizer.panPublisher
    • UIScreenEdgePanGestureRecognizer.screenEdgePanPublisher
    • UILongPressGestureRecognizer.longPressPublisher
  • UIScrollView.contentOffsetPublisher and UIScrollView.reachedBottomPublisher() added (thanks @jdisho !)

0.0.1 - 2019-08-03 15:30:03

For Ethan 👶