Extensions for Apple Combine framework.
NOTE: The package is in beta
-
Proxies
- DelegateProxy
- PublishersProxy
extension PublishersProxy where Base: UISearchBar { /// Combine wrapper for `UISearchBarDelegate.searchBarCancelButtonClicked(_:)` public var cancelButtonClicked: some Publisher<Void, Never> { let selector = _makeMethodSelector( selector: #selector(UISearchBarDelegate.searchBarCancelButtonClicked(_:)), signature: base.delegate?.searchBarCancelButtonClicked(_:) ) return delegateProxy.proxy_intercept(selector).replaceOutput(with: ()) } private var delegateProxy: UISearchBarDelegateProxy { .proxy(for: base, \.delegate) } } private class UISearchBarDelegateProxy: DelegateProxy<UISearchBarDelegate>, UISearchBarDelegate {}
-
TypeErasure
NoOptionsScheduler
AnySubject
AnySubscriber
-
Selectors interception
-
Cancellables
- NonScopedCancellable
-
Operators (todo: implement using separate Publisher types instead of erasing to AnyPublisher)
- SinkOnce
- SinkEvents
- SinkValues
-
Subjects:
- PublishSubject
-
Subscribers
- CancelTrackingSubscriber
-
Subscriptions
- CancelTrackingSubscription
-
DemandBuffer
-
Materialize/Dematerialize
-
Relays
-
Look at CombineExt for more ideas
You can add CombineExtensions to an Xcode project by adding it as a package dependency.
- From the File menu, select Swift Packages › Add Package Dependency…
- Enter
"https://github.com/capturecontext/combine-extensions.git"
into the package repository URL text field - Choose products you need to link them to your project.
If you use SwiftPM for your project, you can add CombineExtensions to your package file.
.package(
url: "https://github.com/capturecontext/combine-extensions.git",
.upToNextMinor(from: "0.2.0")
)
Do not forget about target dependencies:
.product(
name: "CombineExtensions",
package: "combine-extensions"
)
.product(
name: "CombineExtensionsMacros",
package: "combine-extensions"
)
This library is released under the MIT license. See LICENCE for details.
See [ACKNOWLEDGMENTS][ACKNOWLEDGMENTS] for inspiration references and their licences.