CBLArray
@protocol CBLArray <CBLReadOnlyArray, CBLArrayFragment>
CBLArray protocol defines a set of methods for getting and setting array data.
-
Set an array as a content. Allowed value types are NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString, CBLArray, CBLBlob, CBLDictionary. The NSArrays and NSDictionaries must contain only the above types. Setting the new array content will replace the current data including the existing CBLArray and CBLDictionary objects.
Declaration
Objective-C
- (void)setArray:(nullable NSArray *)array;
Parameters
array
the array.
-
Sets an object at the given index. Setting a nil value is eqivalent to setting an NSNull object. - parameter: object the object. - parameter: index the index. This value must not exceed the bounds of the array.
Declaration
Objective-C
- (void)setObject:(nullable id)object atIndex:(NSUInteger)index;
Parameters
object
index
-
Adds an object to the end of the array. Adding a nil value is equivalent to adding an NSNull object. - parameter: object the object.
Declaration
Objective-C
- (void)addObject:(nullable id)object;
Parameters
object
-
Inserts an object at the given index. Inserting a nil value is equivalent to inserting an NSNull object. - parameter: object the object. - parameter: index the index. This value must not exceed the bounds of the array.
Declaration
Objective-C
- (void)insertObject:(nullable id)object atIndex:(NSUInteger)index;
Parameters
object
index
-
Removes the object at the given index. - parameter: index the index. This value must not exceed the bounds of the array.
Declaration
Objective-C
- (void)removeObjectAtIndex:(NSUInteger)index;
Parameters
index
-
Gets a CBLArray at the given index. Returns nil if the value is not an array. - parameter: index the index. This value must not exceed the bounds of the array. @result the CBLArray object.
Declaration
Objective-C
- (nullable CBLArray *)arrayAtIndex:(NSUInteger)index;
Parameters
index
-
Gets a CBLDictionary at the given index. Returns nil if the value is not a dictionary. - parameter: index the index. This value must not exceed the bounds of the array. @result the CBLDictionary object.
Declaration
Objective-C
- (nullable CBLDictionary *)dictionaryAtIndex:(NSUInteger)index;
Parameters
index
-
Subscripting access to a CBLFragment object that represents the value at the given index. - parameter: index the index. If the index value exceeds the bounds of the array, the CBLFragment will represent a nil value. @result the CBLFragment object.
Declaration
Objective-C
- (nonnull CBLFragment *)objectAtIndexedSubscript:(NSUInteger)index;
Parameters
index