MutableDictionaryObject
public class MutableDictionaryObject: DictionaryObject, MutableDictionaryProtocol
MutableDictionaryObject provides access to dictionary data.
-
Initialize a new empty MutableDictionaryObject object.
Declaration
Swift
public init()
-
Initialzes a new MutableDictionaryObject 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(withData data: Dictionary<String, Any>?)
Parameters
dictionary
the dictionary object.
-
Set a value for the given key. Allowed value types are Array, Date, Dictionary, Number types, NSNull, String, ArrayObject, Blob, DictionaryObject and nil. The Arrays and Dictionaries must contain only the above types. A nil value will be converted to an NSNull. An Date object will be converted to an ISO-8601 format string.
Declaration
Swift
@discardableResult public func setValue(_ value: Any?, forKey key: String) -> Self
Parameters
value
The value.
key
The key.
Return Value
The self object.
-
Set data for the dictionary. 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: Dictionary<String, Any>?) -> Self
Parameters
data
The data.
Return Value
The self object.
-
Removes a given key and its value from the dictionary.
Declaration
Swift
@discardableResult public func removeValue(forKey key: String) -> Self
Parameters
key
The key.
Return Value
The self object.
-
Get a property’s value as an MutableArrayObject, which is a mapping object of an array value. Returns nil if the property doesn’t exists, or its value is not an array.
Declaration
Swift
public override func array(forKey key: String) -> MutableArrayObject?
Parameters
key
The key.
Return Value
The MutableArrayObject object or nil if the property doesn’t exist.
-
Get a property’s value as a MutableDictionaryObject, which is a mapping object of a dictionary value. Returns nil if the property doesn’t exists, or its value is not a dictionary.
Declaration
Swift
public override func dictionary(forKey key: String) -> MutableDictionaryObject?
Parameters
key
The key.
Return Value
The MutableDictionaryObject object.
-
Subscripting access to a MutableFragment object that represents the value of the dictionary by key.
Declaration
Swift
public override subscript(key: String) -> MutableFragment
Parameters
key
The key.
Return Value
The Fragment object.