RLMSyncSubscriptionOptions
@interface RLMSyncSubscriptionOptions : NSObject
Configuration options for query-based sync subscriptions.
-
The name of the subscription.
Naming a subscription makes it possible to look up a subscription by name (using
-[RLMRealm subscriptionWithName:]
) or update an existing subscription rather than creating a new one.Declaration
Objective-C
@property (readwrite, copy, nonatomic, nullable) NSString *name;
-
Whether this should update an existing subscription with the same name.
By default trying to create a subscription with a name that’s already in use will fail unless the new subscription is an exact match for the existing one. If this is set to YES, instead the existing subscription will be updated using the query and options from the new subscription. This only works if the new subscription is for the same type of objects as the existing subscription. Trying to overwrite a subscription with a subscription of a different type of objects will fail.
The
updatedAt
and (iftimeToLive
is used)expiresAt
properties are updated whenever a subscription is overwritten even if nothing else has changed.Declaration
Objective-C
@property (assign, readwrite, nonatomic) BOOL overwriteExisting;
-
How long (in seconds) a subscription should persist after being created.
By default subscriptions are persistent, and last until they are explicitly removed by calling
unsubscribe()
. Subscriptions can instead be made temporary by setting the time to live to how long the subscription should remain. After that time has elapsed the subscription will be automatically removed.A time to live of 0 or less disables subscription expiration.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) NSTimeInterval timeToLive;
-
The maximum number of top-level matches to include in this subscription.
If more top-level objects than the limit match the query, only the first
limit
objects will be included. This respects the sort and distinct order of the query being subscribed to for the determination of what thefirst
objects are.The limit does not count or apply to objects which are added indirectly due to being linked to by the objects in the subscription or due to being listed in
includeLinkingObjectProperties
. If the limit is larger than the number of objects which match the query, all objects will be included. A limit of zero is treated as unlimited.Declaration
Objective-C
@property (assign, readwrite, nonatomic) NSUInteger limit;
-
Which RLMLinkingObjects properties should be included in the subscription.
Outgoing links (i.e.
RLMArray
andRLMObject
properties) are automatically included in sync subscriptions. That is, if you subscribe to a query which matches one object, every object which is reachable via links from that object are also included in the subscription.By default, RLMLinkingObjects properties do not work this way. Instead, they only report objects which happen to be included in a subscription. By naming a RLMLinkingObjects property in this array, it can instead be treated as if it was a RLMArray and include all objects which link to this object.
Any keypath which ends in a RLMLinkingObject property can be included in this array, including ones involving intermediate links.
Declaration
Objective-C
@property (readwrite, copy, nonatomic, nullable) NSArray<NSString *> *includeLinkingObjectProperties;