RLMCollection Protocol Reference
| Conforms to | NSFastEnumeration |
| Declared in | RLMCollection.h |
Tasks
RLMCollection Properties
-
countproperty required method -
objectClassNameproperty required method -
realmproperty required method
Accessing Objects from a Collection
-
– objectAtIndex:required method -
– firstObjectrequired method -
– lastObjectrequired method
Querying a Collection
-
– indexOfObject:required method -
– indexOfObjectWhere:required method -
– indexOfObjectWithPredicate:required method -
– objectsWhere:required method -
– objectsWithPredicate:required method -
– sortedResultsUsingProperty:ascending:required method -
– sortedResultsUsingDescriptors:required method -
– valueForKey:required method -
– setValue:forKey:required method
Properties
count
Number of objects in the collection.
@property (nonatomic, readonly, assign) NSUInteger countDeclared In
RLMCollection.hInstance Methods
firstObject
Returns the first object in the collection.
- (nullable id)firstObjectReturn Value
An RLMObject of the class contained by this RLMCollection.
Discussion
Returns nil if called on an empty RLMCollection.
Declared In
RLMCollection.hindexOfObject:
Gets the index of an object.
- (NSUInteger)indexOfObject:(RLMObject *)objectParameters
- object
An object (of the same type as returned from the objectClassName selector).
Discussion
Returns NSNotFound if the object is not found in this RLMCollection.
Declared In
RLMCollection.hindexOfObjectWhere:
Gets the index of the first object matching the predicate.
- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...Parameters
- predicateFormat
The predicate format string which can accept variable arguments.
Return Value
Index of object or NSNotFound if the object is not found in this RLMCollection.
Declared In
RLMCollection.hindexOfObjectWithPredicate:
Gets the index of the first object matching the predicate.
- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicateParameters
- predicate
The predicate to filter the objects.
Return Value
Index of object or NSNotFound if the object is not found in this RLMCollection.
Declared In
RLMCollection.hlastObject
Returns the last object in the collection.
- (nullable id)lastObjectReturn Value
An RLMObject of the class contained by this RLMCollection.
Discussion
Returns nil if called on an empty RLMCollection.
Declared In
RLMCollection.hobjectAtIndex:
Returns the object at the index specified.
- (id)objectAtIndex:(NSUInteger)indexParameters
- index
The index to look up.
Return Value
An RLMObject of the class contained by this RLMCollection.
Declared In
RLMCollection.hobjectsWhere:
Get objects matching the given predicate in the RLMCollection.
- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...Parameters
- predicateFormat
The predicate format string which can accept variable arguments.
Return Value
An RLMResults of objects that match the given predicate
Declared In
RLMCollection.hobjectsWithPredicate:
Get objects matching the given predicate in the RLMCollection.
- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicateParameters
- predicate
The predicate to filter the objects.
Return Value
An RLMResults of objects that match the given predicate
Declared In
RLMCollection.hsetValue:forKey:
Invokes setValue:forKey: on each of the collection’s objects using the specified value and key.
- (void)setValue:(nullable id)value forKey:(NSString *)keyParameters
- value
The object value.
- key
The name of the property.
Discussion
Warning: This method can only be called during a write transaction.
Declared In
RLMCollection.hsortedResultsUsingDescriptors:
Get a sorted RLMResults from an RLMCollection.
- (RLMResults *)sortedResultsUsingDescriptors:(NSArray *)propertiesParameters
- properties
An array of
RLMSortDescriptors to sort by.
Return Value
An RLMResults sorted by the specified properties.
Declared In
RLMCollection.hsortedResultsUsingProperty:ascending:
Get a sorted RLMResults from an RLMCollection.
- (RLMResults *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascendingParameters
- property
The property name to sort by.
- ascending
The direction to sort by.
Return Value
An RLMResults sorted by the specified property.
Declared In
RLMCollection.hvalueForKey:
Returns an NSArray containing the results of invoking valueForKey: using key on each of the collection’s objects.
- (nullable id)valueForKey:(NSString *)keyParameters
- key
The name of the property.
Return Value
NSArray containing the results of invoking valueForKey: using key on each of the collection’s objects.
Declared In
RLMCollection.h