RVS_GeneralObserverSubTrackerProtocol
public protocol RVS_GeneralObserverSubTrackerProtocol : AnyObject, RVS_GeneralObserverProtocol
This is a class protocol, so we can mutate the properties in the protocol extension, and we won’t have the issue of unlinked references.
-
This is where we will track our subscriptions.
Declaration
Swift
var subscriptions: [RVS_GeneralObservableProtocol] { get set }
-
unsubscribeAll()
Default implementationThis unsubs the observer from all of its subscriptions.
Default Implementation
Default unsubs us from all of our subscriptions.
Declaration
Swift
@discardableResult func unsubscribeAll() -> [RVS_GeneralObservableProtocol]
Return Value
An Array, of all the observables it unsubbed from.
-
internalSubscribedTo(_:
Default implementation) This is called after being subscribed to an Observable.
This is a method that is unique to this protocol, and is used for internal management.
This is called after the Observable’s
observer(_:, didSubscribe:)
method was called.In the default implementation, this is called in the subscription execution context, so that will be the thread used for the callback.
Default Implementation
Default simply adds the observable to our list.
Declaration
Swift
func internalSubscribedTo(_ inObservableInstance: RVS_GeneralObservableProtocol)
-
internalUnsubscribedFrom(_:
Default implementation) This is called after being unsubscribed from an Observable.
This is a method that is unique to this protocol, and is used for internal management.
This is called after the Observable’s
observer(_:, didSubscribe:)
method was called.In the default implementation, this is called in the unsubscription execution context, so that will be the thread used for the callback.
Default Implementation
Default simply removes the observable from our list.
Declaration
Swift
func internalUnsubscribedFrom(_ inObservableInstance: RVS_GeneralObservableProtocol)