public class SyncSubscription<Type: RealmCollectionValue>
SyncSubscription represents a subscription to a set of objects in a synced Realm.
When partial sync is enabled for a synced Realm, the only objects that the server synchronizes to the
client are those that match a sync subscription registered by that client. A subscription consists of
of a query (represented by a
Results) and an optional name.
Changes to the state of the subscription can be observed using
Subscriptions are created using
The name of the subscription.
This will be
nilif a name was not provided when the subscription was created.
public var name: String?
Observe the subscription for state changes.
When the state of the subscription changes,
blockwill be invoked and passed the new state.
The token returned from this function does not hold a strong reference to this subscription object. This means that you must hold a reference to the subscription object itself along with the returned token in order to actually receive updates about the state.
The path to observe. Must be
Options for the observation. Only
NSKeyValueObservingOptions.initialoption is is supported at this time.
The block to be called whenever a change occurs.
A token which must be held for as long as you want updates to be delivered.
Remove this subscription
Removing a subscription will delete all objects from the local Realm that were matched only by that subscription and not any remaining subscriptions. The deletion is performed by the server, and so has no immediate impact on the contents of the local Realm. If the device is currently offline, the removal will not be processed until the device returns online.
public func unsubscribe()