CBLDictionary
@protocol CBLDictionary <CBLReadOnlyDictionary, CBLDictionaryFragment>
CBLDictionary protocol defines a set of methods for getting and setting dictionary data.
-
Set a dictionary as a content. Allowed value types are NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString, CBLArray, CBLBlob, CBLDictionary. The NSArrays and NSDictionaries must contain only the above types. Setting the new dictionary content will replace the current data including the existing CBLArray and CBLDictionary objects. - parameter: dictionary the dictionary.
Declaration
Objective-C
- (void)setDictionary:(nullable NSDictionary<NSString *, id> *)dictionary;
Parameters
dictionary
-
Set an object value by key. Allowed value types are NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString, CBLArray, CBLBlob, CBLDictionary. The NSArrays and NSDictionaries must contain only the above types. An NSDate value will be converted to an ISO-8601 format string. A nil value will be converted an NSNull object. - parameter: value the object value. - parameter: key the key.
Declaration
Objective-C
- (void)setObject:(nullable id)value forKey:(nonnull NSString *)key;
Parameters
value
key
-
Removes a given key and its value from the dictionary. - parameter: key the key.
Declaration
Objective-C
- (void)removeObjectForKey:(nonnull NSString *)key;
Parameters
key
-
Get a property’s value as a CBLArray, which is a mapping object of an array value. Returns nil if the property doesn’t exists, or its value is not an array. - parameter: key the key. @result the CBLArray object or nil if the property doesn’t exist.
Declaration
Objective-C
- (nullable CBLArray *)arrayForKey:(nonnull NSString *)key;
Parameters
key
-
Get a property’s value as a CBLDictionary, which is a mapping object of a dictionary value. Returns nil if the property doesn’t exists, or its value is not a dictionary. - parameter: key the key. @result the CBLDictionary object or nil if the key doesn’t exist.
Declaration
Objective-C
- (nullable CBLDictionary *)dictionaryForKey:(nonnull NSString *)key;
Parameters
key
-
Subscripting access to a CBLFragment object that represents the value of the dictionary by key. - parameter: key the key. @result the CBLFragment object.
Declaration
Objective-C
- (nonnull CBLFragment *)objectForKeyedSubscript:(nonnull NSString *)key;
Parameters
key