RLMSyncPermissionResults
@interface RLMSyncPermissionResults : NSObject <NSFastEnumeration>
A collection object representing the results of a permissions query.
This collection will automatically update its contents at the start of each runloop iteration, but the objects it vends are immutable.
Permission results objects are thread-confined, and should not be shared across threads.
Warning
Permission results must only be fetched on threads that have an active run loop. In most cases this will be the main thread.-
The number of results contained within the object.
Declaration
Objective-C
@property (readonly, nonatomic) NSInteger count;
Swift
var count: Int { get }
-
Return the first permission, or nil if the collection is empty.
Declaration
Objective-C
- (nullable RLMSyncPermissionValue *)firstObject;
-
Return the last permission, or nil if the collection is empty.
Declaration
Objective-C
- (nullable RLMSyncPermissionValue *)lastObject;
-
Retrieve the permission value at the given index. Throws an exception if the index is out of bounds.
Declaration
Objective-C
- (nonnull RLMSyncPermissionValue *)objectAtIndex:(NSInteger)index;
Swift
func object(at index: Int) -> RLMSyncPermissionValue
-
Returns the index of the permission in the collection, or
NSNotFound
if the permission is not found in the collection.Declaration
Objective-C
- (NSInteger)indexOfObject:(nonnull RLMSyncPermissionValue *)object;
Swift
func index(ofObject object: RLMSyncPermissionValue) -> Int
-
Register to be notified when the contents of the results object change.
This method returns a token. Hold on to the token for as long as notifications are desired. Call
-stop
on the token to stop notifications, and before deallocating the token.Declaration
Objective-C
- (nonnull RLMNotificationToken *)addNotificationBlock: (nonnull RLMPermissionStatusBlock)block;
Swift
func addNotificationBlock(_ block: @escaping RLMPermissionStatusBlock) -> RLMNotificationToken
-
Return all permissions matching the given predicate in the collection.
Note
Valid properties to filter on arepath
anduserId
, as well as the boolean propertiesmayRead
,mayWrite
, andmayManage
.Declaration
Objective-C
- (nonnull RLMSyncPermissionResults *)objectsWithPredicate: (nonnull NSPredicate *)predicate;
Swift
func objects(with predicate: NSPredicate) -> RLMSyncPermissionResults
-
Return a sorted
RLMSyncPermissionResults
from the collection, sorted based on the given property.Declaration
Objective-C
- (nonnull RLMSyncPermissionResults *) sortedResultsUsingProperty:(RLMSyncPermissionResultsSortProperty)property ascending:(BOOL)ascending;
Swift
func sortedResults(using property: RLMSyncPermissionResultsSortProperty, ascending: Bool) -> RLMSyncPermissionResults