ArrayObject
public class ArrayObject: ReadOnlyArrayObject, ArrayProtocol
ArrayObject provides access to array data.
-
Initialize a new empty CBLArray object.
Declaration
Swift
public init()
-
Initialize a new ArrayObject object with an array content. Allowed value types are NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString, ArrayObject, CBLBlob, DictionaryObject. The NSArrays and NSDictionaries must contain only the above types.
Declaration
Swift
public init(array: Array<Any>?)
Parameters
array
the array object.
-
Set an array as a content. Allowed value types are Array, Date, Dictionary, Number, NSNull, String, ArrayObject, Blob, DictionaryObject. The Array and Dictionary must contain only the above types. Setting the new array content will replace the current data including the existing ArrayObject and DictionaryObject objects.
Declaration
Swift
@discardableResult public func setArray(_ array: Array<Any>?) -> Self
Parameters
array
the array.
Return Value
the ArrayObject object. */
-
Sets an object at the given index. Setting a nil value is eqivalent to setting an NSNull object.
Declaration
Swift
@discardableResult public func set(_ value: Any?, at index: Int) -> Self
Parameters
object
the object.
index
the index. This value must not exceed the bounds of the array.
Return Value
the ArrayObject object.
-
Adds an object to the end of the array. Adding a nil value is equivalent to adding an NSNull object.
Declaration
Swift
@discardableResult public func add(_ value: Any?) -> Self
Parameters
object
the object.
Return Value
the ArrayObject object.
-
Inserts an object at the given index. Inserting a nil value is equivalent to inserting an NSNull object.
Declaration
Swift
@discardableResult public func insert(_ value: Any?, at index: Int) -> Self
Parameters
object
the object.
index
the index. This value must not exceed the bounds of the array.
Return Value
the ArrayObject object.
-
Removes the object at the given index.
Declaration
Swift
@discardableResult public func remove(at index: Int) -> Self
Parameters
index
the index. This value must not exceed the bounds of the array.
Return Value
the ArrayObject object.
-
Gets an ArrayObject at the given index. Returns nil if the value is not an array.
Declaration
Swift
public override func array(at index: Int) -> ArrayObject?
Parameters
index
the index. This value must not exceed the bounds of the array.
Return Value
the ArrayObject.
-
Gets a DictionaryObject at the given index. Returns nil if the value is not a dictionary.
Declaration
Swift
public override func dictionary(at index: Int) -> DictionaryObject?
Parameters
index
the index. This value must not exceed the bounds of the array.
Return Value
the DictionaryObject object.
-
Subscripting access to a Fragment object that represents the value at the given index.
Declaration
Swift
public override subscript(index: Int) -> Fragment
Parameters
index
the index. If the index value exceeds the bounds of the array, the Fragment object will represent a nil value.
Return Value
the CBLFragment object. */