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
arrayThe array object.
-
Sets an ArrayObject object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func setArray(_ value: ArrayObject?, at index: Int) -> SelfParameters
valueThe ArrayObject object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets a Blob object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func setBlob(_ value: Blob?, at index: Int) -> SelfParameters
valueThe Blob object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets a boolean value at the given index.
Declaration
Swift
@discardableResult public func setBoolean(_ value: Bool, at index: Int) -> SelfParameters
valueThe boolean value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets a Date object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func setDate(_ value: Date?, at index: Int) -> SelfParameters
valueThe Date object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets a DictionaryObject object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func setDictionary(_ value: DictionaryObject?, at index: Int) -> SelfParameters
valueThe DictionaryObject object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets a double value at the given index.
Declaration
Swift
@discardableResult public func setDouble(_ value: Double, at index: Int) -> SelfParameters
valueThe double value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets a float value at the given index.
Declaration
Swift
@discardableResult public func setFloat(_ value: Float, at index: Int) -> SelfParameters
valueThe float value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets an int value at the given index.
Declaration
Swift
@discardableResult public func setInt(_ value: Int, at index: Int) -> SelfParameters
valueThe int value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets an int64 value at the given index.
Declaration
Swift
@discardableResult public func setInt64(_ value: Int64, at index: Int) -> SelfParameters
valueThe int64 value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets a value at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func setValue(_ value: Any?, at index: Int) -> SelfParameters
valueThe value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Sets a String object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func setString(_ value: String?, at index: Int) -> SelfParameters
valueThe String object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Adds an ArrayObject object to the end of the array. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func addArray(_ value: ArrayObject?) -> SelfParameters
valueThe ArrayObject object.
Return Value
The ArrayObject object.
-
Adds a Blob object to the end of the array. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func addBlob(_ value: Blob?) -> SelfParameters
valueThe Blob object.
Return Value
The ArrayObject object.
-
Adds a boolean value to the end of the array.
Declaration
Swift
@discardableResult public func addBoolean(_ value: Bool) -> SelfParameters
valueThe boolean value.
Return Value
The ArrayObject object.
-
Adds a Date object to the end of the array. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func addDate(_ value: Date?) -> SelfParameters
valueThe Date object.
Return Value
The ArrayObject object.
-
Adds a Dictionary object to the end of the array. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func addDictionary(_ value: DictionaryObject?) -> SelfParameters
valueThe Dictionary object.
Return Value
The ArrayObject object.
-
Adds a double value to the end of the array.
Declaration
Swift
@discardableResult public func addDouble(_ value: Double) -> SelfParameters
valueThe double value.
Return Value
The ArrayObject object.
-
Adds a float value to the end of the array.
Declaration
Swift
@discardableResult public func addFloat(_ value: Float) -> SelfParameters
valueThe double value.
Return Value
The ArrayObject object.
-
Adds an int value to the end of the array.
Declaration
Swift
@discardableResult public func addInt(_ value: Int) -> SelfParameters
valueThe integer value.
Return Value
The ArrayObject object.
-
Adds an int64 value to the end of the array.
Declaration
Swift
@discardableResult public func addInt64(_ value: Int64) -> SelfParameters
valueThe integer value.
Return Value
The ArrayObject object.
-
Adds a value to the end of the array. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func addValue(_ value: Any?) -> SelfParameters
valueThe value.
Return Value
The ArrayObject object.
-
Adds a String object to the end of the array. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func addString(_ value: String?) -> SelfParameters
valueThe String object.
Return Value
The ArrayObject object.
-
Inserts an ArrayObject at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertArray(_ value: ArrayObject?, at index: Int) -> SelfParameters
valueThe ArrayObject object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts a Blob object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertBlob(_ value: Blob?, at index: Int) -> SelfParameters
valueThe Blob object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts a boolean value at the given index.
Declaration
Swift
@discardableResult public func insertBoolean(_ value: Bool, at index: Int) -> SelfParameters
valueThe boolean value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts a Date object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertDate(_ value: Date?, at index: Int) -> SelfParameters
valueThe Date object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts a Dictionary object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertDictionary(_ value: DictionaryObject?, at index: Int) -> SelfParameters
valueThe Dictionary object.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts a double value at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertDouble(_ value: Double, at index: Int) -> SelfParameters
valueThe double value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts a float value at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertFloat(_ value: Float, at index: Int) -> SelfParameters
valueThe float value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts an int value at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertInt(_ value: Int, at index: Int) -> SelfParameters
valueThe int value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts an int64 value at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertInt64(_ value: Int64, at index: Int) -> SelfParameters
valueThe int64 value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts a value at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertValue(_ value: Any?, at index: Int) -> SelfParameters
valueThe value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Inserts a String object at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertString(_ value: String?, at index: Int) -> SelfParameters
valueThe String object.
indexThe 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) -> SelfParameters
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject 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>?) -> SelfParameters
arrayThe 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
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
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
indexThe 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) -> FragmentParameters
indexThe index. If the index value exceeds the bounds of the array, the Fragment object will represent a nil value.
Return Value
The Fragment object.
ArrayObject Class Reference