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.
-
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) -> Self
Parameters
value
The ArrayObject object.
index
The 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) -> Self
Parameters
value
The Blob object.
index
The 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) -> Self
Parameters
value
The boolean value.
index
The 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) -> Self
Parameters
value
The Date object.
index
The 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) -> Self
Parameters
value
The DictionaryObject object.
index
The 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) -> Self
Parameters
value
The double value.
index
The 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) -> Self
Parameters
value
The float value.
index
The 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) -> Self
Parameters
value
The int value.
index
The 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) -> Self
Parameters
value
The int64 value.
index
The 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) -> Self
Parameters
value
The value.
index
The 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) -> Self
Parameters
value
The String object.
index
The 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?) -> Self
Parameters
value
The 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?) -> Self
Parameters
value
The 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) -> Self
Parameters
value
The 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?) -> Self
Parameters
value
The 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?) -> Self
Parameters
value
The 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) -> Self
Parameters
value
The 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) -> Self
Parameters
value
The 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) -> Self
Parameters
value
The 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) -> Self
Parameters
value
The 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?) -> Self
Parameters
value
The 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?) -> Self
Parameters
value
The 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) -> Self
Parameters
value
The ArrayObject object.
index
The 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) -> Self
Parameters
value
The Blob object.
index
The 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) -> Self
Parameters
value
The boolean value.
index
The 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) -> Self
Parameters
value
The Date object.
index
The 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) -> Self
Parameters
value
The Dictionary object.
index
The 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) -> Self
Parameters
value
The double value.
index
The 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) -> Self
Parameters
value
The float value.
index
The 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) -> Self
Parameters
value
The int value.
index
The 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) -> Self
Parameters
value
The int64 value.
index
The 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) -> Self
Parameters
value
The value.
index
The 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) -> Self
Parameters
value
The String 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.
-
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.
-
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 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
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 Fragment object.