MutableArrayObject

public final class MutableArrayObject : ArrayObject, MutableArrayProtocol

MutableArrayObject provides access to array data.

Initializers

  • 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

    array

    The 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) throws

    Parameters

    json

    The JSON string with data.

Type Setters

  • 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 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) -> Self

    Parameters

    value

    The String object.

    index

    The 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) -> Self

    Parameters

    value

    The Number value.

    index

    The 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) -> Self

    Parameters

    value

    The int value.

    index

    The 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) -> Self

    Parameters

    value

    The int64 value.

    index

    The 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) -> Self

    Parameters

    value

    The float value.

    index

    The 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) -> Self

    Parameters

    value

    The double value.

    index

    The 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) -> Self

    Parameters

    value

    The boolean value.

    index

    The 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) -> Self

    Parameters

    value

    The Date object.

    index

    The 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) -> Self

    Parameters

    value

    The Blob object.

    index

    The 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) -> Self

    Parameters

    value

    The ArrayObject object.

    index

    The 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) -> Self

    Parameters

    value

    The DictionaryObject object.

    index

    The index. This value must not exceed the bounds of the array.

    Return Value

    The self object.

Type Appenders

  • 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 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?) -> Self

    Parameters

    value

    The 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?) -> Self

    Parameters

    value

    The 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) -> Self

    Parameters

    value

    The 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) -> Self

    Parameters

    value

    The 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) -> Self

    Parameters

    value

    The 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) -> Self

    Parameters

    value

    The 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) -> Self

    Parameters

    value

    The 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?) -> Self

    Parameters

    value

    The 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?) -> Self

    Parameters

    value

    The 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?) -> Self

    Parameters

    value

    The 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?) -> Self

    Parameters

    value

    The Dictionary object.

    Return Value

    The self object.

Type Inserters

  • 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 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) -> Self

    Parameters

    value

    The String object.

    index

    The 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) -> Self

    Parameters

    value

    The number value.

    index

    The 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) -> Self

    Parameters

    value

    The int value.

    index

    The 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) -> Self

    Parameters

    value

    The int64 value.

    index

    The 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) -> Self

    Parameters

    value

    The float value.

    index

    The 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) -> Self

    Parameters

    value

    The double value.

    index

    The 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) -> Self

    Parameters

    value

    The boolean value.

    index

    The 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) -> Self

    Parameters

    value

    The Date object.

    index

    The 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) -> Self

    Parameters

    value

    The Blob object.

    index

    The 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) -> Self

    Parameters

    value

    The ArrayObject object.

    index

    The 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) -> Self

    Parameters

    value

    The Dictionary object.

    index

    The index. This value must not exceed the bounds of the array.

    Return Value

    The self object.

Removing Value

  • Removes the object at the given index.

    Declaration

    Swift

    @discardableResult
    public func removeValue(at index: Int) -> Self

    Parameters

    index

    The index. This value must not exceed the bounds of the array.

    Return Value

    The self object.

Data

  • 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>) -> Self

    Parameters

    array

    The array.

    Return Value

    The self object.

Set JSON

  • Set data with JSON string.

    Throws

    An error on a failure.

    Declaration

    Swift

    @discardableResult
    public func setJSON(_ json: String) throws -> Self

    Parameters

    json

    The JSON string with data.

    Return Value

    The self object.

Getting ArrayObject and DictionaryObject

  • 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

    index

    The 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

    index

    The index. This value must not exceed the bounds of the array.

    Return Value

    The MutableDictionaryObject object.

ArrayFragment

  • Subscripting access to a MutableFragment object that represents the value at the given index.

    Declaration

    Swift

    public override subscript(index: Int) -> MutableFragment { get }

    Parameters

    index

    The 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