DatasyncSubscription
public final class DatasyncSubscription : Hashable, CustomStringConvertible, CustomDebugStringConvertible
An object representing a subscription to Datasync events.
Instances are created by the DatasyncNode.subscribe(to:childrenConstraint:stores:file:line:queue:onEvent:onCompletion:) method.
A subscription is cancelled:
- explicitly using the
DatasyncSubscription.cancel()method, - implicitly when it is stored in a
DatasyncManagerwhich is deinitialized, including when it has other references, - implicitly when it is deinitialized.
-
The type of events concerned by this subscription.
This value corresponds to the
toparameter of theDatasyncNode.subscribe(to:childrenConstraint:stores:file:line:queue:onEvent:onCompletion:)method call used to subscribe.Declaration
Swift
public let eventType: DatasyncEventType -
The policy to applied to this subscription when it is completed.
This property is initialized using the value of the
DatasyncManager.defaultCompletedSubscriptionPolicyproperty of the manager from which it has been created. Any modification must be made before the completion callback is called to be sure that it is taken into account.Declaration
Swift
public var completedSubscriptionPolicy: DatasyncCompletedSubscriptionPolicy { get set }
-
The constraint to filter children used to take the subscription.
This value corresponds to the
childrenConstraintparameter of theDatasyncNode.subscribe(to:childrenConstraint:stores:file:line:queue:onEvent:onCompletion:)method call used to subscribe.Declaration
Swift
public var childrenConstraint: DatasyncChildrenConstraint { get } -
Cancels this subscription.
It is safe canceling the same subscription several times. Canceling an already-cancelled subscription is a no-operation.
Depending on the
DatasyncManager.subscriptionCancellationPolicy, the SDK can continue to silently maintain up-to-date the cache for that subscription.Declaration
Swift
@discardableResult public func cancel() -> BoolReturn Value
trueif the subscription has been cancelled by this call,falseif it had already been cancelled before.
-
Declaration
Swift
public static func == (left: DatasyncSubscription, right: DatasyncSubscription) -> Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public var debugDescription: String { get }