MutableArrayObject
public final class MutableArrayObject : ArrayObject, MutableArrayProtocol
MutableArrayObject provides access to array data.
-
Initialize a new empty MutableArrayObject.
Declaration
Swift
public init() -
Initialize a new MutableArrayObject object with the data. Allowed value types are Array, ArrayObject, Blob, Date, Dictionary, DictionaryObject, NSNull, Number types, and String. The Arrays and Dictionaries must contain only the above types.
Declaration
Swift
public init(data: Array<Any>)Parameters
arrayThe array object.
-
Initialize a new MutableArray object with data as a JSON string.
Throws
An error on a failure.Declaration
Swift
public init(json: String) throwsParameters
jsonThe JSON string with data.
-
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 self 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 self object.
-
Sets a Number value at the given index.
Declaration
Swift
@discardableResult public func setNumber(_ value: NSNumber?, at index: Int) -> SelfParameters
valueThe Number value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The self 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 self 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 self 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 self 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 self 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 self 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 self 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 self 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 self 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 self 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 self 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 self object.
-
Adds a Number value to the end of the array.
Declaration
Swift
@discardableResult public func addNumber(_ value: NSNumber?) -> SelfParameters
valueThe Number value.
Return Value
The self object.
-
Adds an int value to the end of the array.
Declaration
Swift
@discardableResult public func addInt(_ value: Int) -> SelfParameters
valueThe int 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 int64 value.
Return Value
The self 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 self 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 self 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 self 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 self 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 self 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 self 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 self 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 self 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 self object.
-
Inserts a Number value at the given index. A nil value will be converted to an NSNull.
Declaration
Swift
@discardableResult public func insertNumber(_ value: NSNumber?, at index: Int) -> SelfParameters
valueThe number value.
indexThe index. This value must not exceed the bounds of the array.
Return Value
The self 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 self 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 self 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 self 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 self 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 self 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 self 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 self 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 self 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 self object.
-
Removes the object at the given index.
Declaration
Swift
@discardableResult public func removeValue(at index: Int) -> SelfParameters
indexThe index. This value must not exceed the bounds of the array.
Return Value
The self object.
-
Set data for the array. Allowed value types are Array, ArrayObject, Blob, Date, Dictionary, DictionaryObject, NSNull, Number types, and String. The Arrays and Dictionaries must contain only the above types.
Declaration
Swift
@discardableResult public func setData(_ data: Array<Any>) -> SelfParameters
arrayThe array.
Return Value
The self object.
-
Set data with JSON string.
Throws
An error on a failure.Declaration
Swift
@discardableResult public func setJSON(_ json: String) throws -> SelfParameters
jsonThe JSON string with data.
Return Value
The self object.
-
Gets an MutableArrayObject at the given index. Returns nil if the value is not an array.
Declaration
Swift
public override func array(at index: Int) -> MutableArrayObject?Parameters
indexThe index. This value must not exceed the bounds of the array.
Return Value
The ArrayObject object.
-
Gets a MutableDictionaryObject at the given index. Returns nil if the value is not a dictionary.
Declaration
Swift
public override func dictionary(at index: Int) -> MutableDictionaryObject?Parameters
indexThe index. This value must not exceed the bounds of the array.
Return Value
The MutableDictionaryObject object.
-
Subscripting access to a MutableFragment object that represents the value at the given index.
Declaration
Swift
public override subscript(index: Int) -> MutableFragment { get }Parameters
indexThe index. If the index value exceeds the bounds of the array, the MutableFragment object will represent a nil value.
Return Value
The Fragment object.
-
Mutable Objects will throw an exception, when called toJSON
Declaration
Swift
public override func toJSON() -> String
MutableArrayObject Class Reference