CBLDictionary
@protocol CBLDictionary <CBLReadOnlyDictionary, CBLDictionaryFragment>
CBLDictionary protocol defines a set of methods for getting and setting dictionary data.
-
Set a CBLArray object for the given key. A nil value will be converted to an NSNull.
Declaration
Objective-C
- (void)setArray:(nullable CBLArray *)value forKey:(nonnull NSString *)key;Parameters
valueThe CBLArray object.
-
Set a CBLBlob object for the given key. A nil value will be converted to an NSNull.
Declaration
Objective-C
- (void)setBlob:(nullable CBLBlob *)value forKey:(nonnull NSString *)key;Parameters
valueThe CBLBolb object.
-
Set a boolean value for the given key.
Declaration
Objective-C
- (void)setBoolean:(BOOL)value forKey:(nonnull NSString *)key;Parameters
valueThe boolean value.
-
Set a Date object for the given key. A nil value will be converted to an NSNull.
Declaration
Objective-C
- (void)setDate:(nullable NSDate *)value forKey:(nonnull NSString *)key;Parameters
valueThe Date object.
-
Set a CBLDictionary object for the given key. A nil value will be converted to an NSNull.
Declaration
Objective-C
- (void)setDictionary:(nullable CBLDictionary *)value forKey:(nonnull NSString *)key;Parameters
valueThe CBLDictionary object.
-
Set a double value for the given key.
Declaration
Objective-C
- (void)setDouble:(double)value forKey:(nonnull NSString *)key;Parameters
valueThe double value.
-
Set a float value for the given key.
Declaration
Objective-C
- (void)setFloat:(float)value forKey:(nonnull NSString *)key;Parameters
valueThe float value.
-
Set an integer value for the given key.
Declaration
Objective-C
- (void)setInteger:(NSInteger)value forKey:(nonnull NSString *)key;Parameters
valueThe integer value.
-
Set a long long value for the given key.
Declaration
Objective-C
- (void)setLongLong:(long long)value forKey:(nonnull NSString *)key;Parameters
valueThe long long value.
-
Set an NSNumber object for the given key. A nil value will be converted to an NSNull.
Declaration
Objective-C
- (void)setNumber:(nullable NSNumber *)value forKey:(nonnull NSString *)key;Parameters
valueThe NSNumber object.
-
Set an object value for the given key. Allowed value types are CBLArray, CBLBlob, CBLDictionary, NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString. 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.
Declaration
Objective-C
- (void)setObject:(nullable id)value forKey:(nonnull NSString *)key;Parameters
valueThe object value.
keyThe key.
-
Set an String object for the given key. A nil value will be converted to an NSNull.
Declaration
Objective-C
- (void)setString:(nullable NSString *)value forKey:(nonnull NSString *)key;Parameters
valueThe String object.
-
Set a dictionary as a content. Allowed value types are CBLArray, CBLBlob, CBLDictionary, NSArray, NSDate, NSDictionary, NSNumber, NSNull, NSString. 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.
Declaration
Objective-C
- (void)setDictionary:(nullable NSDictionary<NSString *, id> *)dictionary;Parameters
dictionaryThe dictionary.
-
Removes a given key and its value from the dictionary.
Declaration
Objective-C
- (void)removeObjectForKey:(nonnull NSString *)key;Parameters
keyThe 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.
Declaration
Objective-C
- (nullable CBLArray *)arrayForKey:(nonnull NSString *)key;Parameters
keyThe key.
Return Value
The CBLArray object or nil if the property doesn’t exist.
-
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.
Declaration
Objective-C
- (nullable CBLDictionary *)dictionaryForKey:(nonnull NSString *)key;Parameters
keyThe key.
Return Value
The CBLDictionary object or nil if the key doesn’t exist.
-
Subscripting access to a CBLFragment object that represents the value of the dictionary by key.
Declaration
Objective-C
- (nonnull CBLFragment *)objectForKeyedSubscript:(nonnull NSString *)key;Parameters
keyThe key.
Return Value
The CBLFragment object.
CBLDictionary Protocol Reference