RLMCollectionChange
@interface RLMCollectionChange : NSObject
A RLMCollectionChange object encapsulates information about changes to collections
that are reported by Realm notifications.
RLMCollectionChange is passed to the notification blocks registered with
-addNotificationBlock on RLMArray and RLMResults, and reports what rows in the
collection changed since the last time the notification block was called.
The change information is available in two formats: a simple array of row
indices in the collection for each type of change, and an array of index paths
in a requested section suitable for passing directly to UITableView‘s batch
update methods. A complete example of updating a UITableView named tv:
[tv beginUpdates];
[tv deleteRowsAtIndexPaths:[changes deletionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
[tv insertRowsAtIndexPaths:[changes insertionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
[tv reloadRowsAtIndexPaths:[changes modificationsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic];
[tv endUpdates];
All of the arrays in an RLMCollectionChange are always sorted in ascending order.
-
The indices of objects in the previous version of the collection which have been removed from this one.
Declaration
Objective-C
@property (readonly, nonatomic) NSArray<NSNumber *> *_Nonnull deletions; -
The indices in the new version of the collection which were newly inserted.
Declaration
Objective-C
@property (readonly, nonatomic) NSArray<NSNumber *> *_Nonnull insertions; -
The indices in the new version of the collection which were modified.
For
RLMResults, this means that one or more of the properties of the object at that index were modified (or an object linked to by that object was modified).For
RLMArray, the array itself being modified to contain a different object at that index will also be reported as a modification.Declaration
Objective-C
@property (readonly, nonatomic) NSArray<NSNumber *> *_Nonnull modifications; -
Returns the index paths of the deletion indices in the given section.
Declaration
Objective-C
- (nonnull NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section; -
Returns the index paths of the insertion indices in the given section.
Declaration
Objective-C
- (nonnull NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section; -
Returns the index paths of the modification indices in the given section.
Declaration
Objective-C
- (nonnull NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section;
View on GitHub
Install in Dash
RLMCollectionChange Class Reference