ReadOnlyArrayObject
public class ReadOnlyArrayObject: ReadOnlyArrayProtocol
ReadOnlyArrayObject provides readonly access to array data.
-
Gets a number of the items in the array.
Declaration
Swift
public var count: Int
-
Gets the value at the given index as a ReadOnlyArrayObject value, which is a mapping object of an array value. Returns nil if the value doesn’t exists, or its value is not an array.
Declaration
Swift
public func array(at index: Int) -> ReadOnlyArrayObject?
Parameters
index
The index.
Return Value
The ReadOnlyArrayObject at the given index.
-
Get the Blob value at the given index. Returns nil if the value doesn’t exist, or its value is not a blob.
Declaration
Swift
public func blob(at index: Int) -> Blob?
Parameters
index
The index.
Return Value
The Blob value located at the index.
-
Gets the value at the given index as a boolean value. Returns true if the value exists, and is either
true
or a nonzero number.Declaration
Swift
public func boolean(at index: Int) -> Bool
Parameters
index
The index.
Return Value
The Bool value located at the index.
-
Gets value at the given index as an Date. JSON does not directly support dates, so the actual property value must be a string, which is then parsed according to the ISO-8601 date format (the default used in JSON.) Returns nil if the value doesn’t exist, is not a string, or is not parseable as a date. NOTE: This is not a generic date parser! It only recognizes the ISO-8601 format, with or without milliseconds.
Declaration
Swift
public func date(at index: Int) -> Date?
Parameters
index
The index.
Return Value
The Date value at the given index.
-
Get the value at the given index as a ReadOnlyDictionaryObject value, which is a mapping object of a dictionary value. Returns nil if the value doesn’t exists, or its value is not a dictionary.
Declaration
Swift
public func dictionary(at index: Int) -> ReadOnlyDictionaryObject?
Parameters
index
The index.
Return Value
The ReadOnlyDictionaryObject
-
Gets the value at the given index as a float value. Integers will be converted to float. The value
true
is returned as 1.0,false
as 0.0. / Returns 0.0 if the value doesn’t exist or does not have a numeric value.Declaration
Swift
public func float(at index: Int) -> Float
Parameters
index
The index.
Return Value
The Float value located at the index.
-
Gets the value at the given index as a double value. Integers will be converted to double. The value
true
is returned as 1.0,false
as 0.0. Returns 0.0 if the property doesn’t exist or does not have a numeric value.Declaration
Swift
public func double(at index: Int) -> Double
Parameters
index
The index.
Return Value
The Double value located at the index.
-
Gets value at the given index as an integer value. Floating point values will be rounded. The value
true
is returned as 1,false
as 0. Returns 0 if the value doesn’t exist or does not have a numeric value.Declaration
Swift
public func int(at index: Int) -> Int
Parameters
index
The index.
Return Value
The integer value located at the index.
-
Gets value at the given index as an integer value. Floating point values will be rounded. The value
true
is returned as 1,false
as 0. Returns 0 if the value doesn’t exist or does not have a numeric value.Declaration
Swift
public func int64(at index: Int) -> Int64
Parameters
index
The index.
Return Value
The integer value located at the index.
-
Gets the value at the given index as a string. Returns nil if the value doesn’t exist, or its value is not a string
Declaration
Swift
public func string(at index: Int) -> String?
Parameters
index
The index.
Return Value
The String object.
-
Gets the value at the given index. The value types are Blob, ReadOnlyArrayObject, ReadOnlyDictionaryObject, Number, or String based on the underlying data type.
Declaration
Swift
public func value(at index: Int) -> Any?
Parameters
index
The index.
Return Value
The value located at the index.
-
Gets content of the current object as an Array object. The values contained in the returned Array object are all JSON based values.
Declaration
Swift
public func toArray() -> Array<Any>
Return Value
The Array object representing the content of the current object in the JSON format.
-
Gets an iterator over items in the array.
Declaration
Swift
public func makeIterator() -> AnyIterator<Any>
Return Value
The array item iterator.
-
Subscript access to a ReadOnlyFragment object by index
Declaration
Swift
public subscript(index: Int) -> ReadOnlyFragment
Parameters
index
The Index.