You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started to add a section on Implementing your own subscriber, but realized there's a lot more learning that I need to do before I can knock it out.
I'm going to kick that back in priority to getting other elements done first.
Here's the snippet that I was thinking to start with, in developingwith.adoc:
== Implementing your own Subscriber
Developing with combine can frequently leverage the two common existing subscribers <<reference.adoc#reference-assign>> and <<reference.adoc#reference-sink>>, or you are working with an Apple framework (such as https://developer.apple.com/documentation/swiftui[SwiftUI]) that is the the subscriber to which you are integrating.
In some cases, you may want to create your own subscriber.
While <<reference.adoc#reference-sink>> can handle most situations, if you want to control the demand that drives the pipelines, you need to provide your own implementation.
__YET TO BE DEVELOPED__
https://developer.apple.com/documentation/combine/subscriber[`Subscriber protocol`]
types:
* Input
* Failure
protocol required functions:
* `receive(Self.Input) -> Subscribers.Demand`
* `receive(subscription: Subscription)`
* `receive(completion: Subscribers.Completion<Self.Failure>)`
* receive() -> Subscribers.Demand (when input void)
maybe based on https://developer.apple.com/documentation/combine/anysubscriber[`AnySubscriber`] which can be initialized with 3 closures:
* receiveSubscription: `((Subscription) -> Void)?``
* receiveValue: `((Input) -> Subscribers.Demand)?``
* receiveCompletion: `((Subscribers.Completion<Failure>) -> Void)?)``
The text was updated successfully, but these errors were encountered:
If you create a custom Subscriber, the publisher sends a Subscription object when you first subscribe to it. Store this subscription, and then call its cancel() method when you want to cancel publishing. When you create a custom subscriber, you should implement the Cancellable protocol, and have your cancel() implementation forward the call to the stored subscription.
I started to add a section on
Implementing your own subscriber
, but realized there's a lot more learning that I need to do before I can knock it out.I'm going to kick that back in priority to getting other elements done first.
Here's the snippet that I was thinking to start with, in
developingwith.adoc
:The text was updated successfully, but these errors were encountered: