DITMutableDocumentPath
@interface DITMutableDocumentPath : NSObject
Provides an interface to specify a path to a key in a document that you can then call various
update functions on. You obtain a DITMutableDocumentPath
by subscripting a
DITMutableDocument
and you can then further subscript a DITMutbaleDocumentPath
to further
specify the key of the document that you want to update.
-
Used to specify a path to a key in the document that you can subscript further to access a nested key in the document and eventually perform an update operation on.
Declaration
Objective-C
- (nonnull DITMutableDocumentPath *)objectForKeyedSubscript: (nonnull NSString *)key;
Parameters
key
The next part of the path needed to get to the key in the document you wish to update.
Return Value
A
DITMutableDocumentPath
with the provided key incorporated into the path. -
Used to specify an index in the array at the preceding key-path specified through the subscripting defined previously. You can subscript the return value further to access a further nested key in the document and eventually perform an update operation.
Declaration
Objective-C
- (nonnull DITMutableDocumentPath *)objectAtIndexedSubscript:(NSUInteger)index;
Parameters
index
The index of the array that you wish to access in the key previously specified with the preceding subscripting.
Return Value
A
DITMutableDocumentPath
with the provided index incorporated into the path. -
Returns the value at the previously specified key in the document as an
NSObject
if possible, otherwise the return value will benil
.Declaration
Objective-C
@property (nonatomic, readonly, nullable) id value;
-
Returns the value at the previously specified key in the document as an
NSString
if possible, otherwise the return value will benil
.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *string;
-
Returns the value at the previously specified key in the document as an
NSString
. If the key was invalid the return value will be an empty string.Declaration
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull stringValue;
-
Returns the value at the previously specified key in the document as a
BOOL
if possible, otherwise the return value will benil
.Declaration
Objective-C
@property (nonatomic, readonly, nullable) BOOL *boolean;
-
Returns the value at the previously specified key in the document as a
BOOL
. If the key was invalid the return value will befalse
.Declaration
Objective-C
@property (nonatomic, readonly) BOOL booleanValue;
-
Returns the value at the previously specified key in the document as an
NSInteger
if possible, otherwise the return value will be 0.Declaration
Objective-C
@property (nonatomic, readonly) NSInteger integerValue;
-
Returns the value at the previously specified key in the document as an
NSNumber
if possible, otherwise the return value will benil
.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSNumber *number;
-
Returns the value at the previously specified key in the document as an
NSNumber
. If the key was invalid the return value will be anNSNumber
with a value of 0.Declaration
Objective-C
@property (nonatomic, readonly) NSNumber *_Nonnull numberValue;
-
Returns the value at the previously specified key in the document as an
NSArray
if possible, otherwise the return value will benil
.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSArray *array;
-
Returns the value at the previously specified key in the document as an
NSArray
. If the key was invalid the return value will be an empty array.Declaration
Objective-C
@property (nonatomic, readonly) NSArray *_Nonnull arrayValue;
-
Returns the value at the previously specified key in the document as an
NSDictionary
if possible, otherwise the return value will benil
.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSDictionary<NSString *, id> *dictionary;
-
Returns the value at the previously specified key in the document as an
NSDictionary
. If the key was invalid the return value will be an empty dictionary.Declaration
Objective-C
@property (nonatomic, readonly) NSDictionary<NSString *, id> *_Nonnull dictionaryValue;
-
Returns the value at the previously specified key in the document as a
DITAttachmentToken
if possible, otherwise the return value will benil
.Declaration
Objective-C
@property (nonatomic, readonly, nullable) DITAttachmentToken *attachmentToken;
-
Set a value at the document’s key defined by the preceding subscripting.
Declaration
Objective-C
- (void)set:(nonnull id)value isDefault:(BOOL)isDefault;
Parameters
value
The value to set at the subscripting-defined document key.
isDefault
Represents whether or not the value should be set as a default value. Set this to
true
if you want to set a default value that you expect to be overwritten by other devices in the network. The default value isfalse
. -
Set a value at the document’s key defined by the preceding subscripting.
Declaration
Objective-C
- (void)set:(nonnull id)value;
Parameters
value
The value to set at the subscripting-defined document key.
-
Remove a value at the document’s key defined by the preceding subscripting. If removing an index from an array, any subsequent indexes will be shifted left to fill the gap.
Declaration
Objective-C
- (void)remove;
-
Replace a value at the document’s key defined by the preceding subscripting with a counter.
Declaration
Objective-C
- (void)replaceWithCounterAsDefault:(BOOL)isDefault;
Parameters
isDefault
Represents whether or not the value is being replaced with a counter that should serve as a default value. Set this to
true
if you want to set a default value that you expect to be overwritten by other devices in the network. The default value isfalse
. -
Replace a value at the document’s key defined by the preceding subscripting with a counter.
Declaration
Objective-C
- (void)replaceWithCounter;
-
Increment a counter at the document’s key defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is a counter.
Declaration
Objective-C
- (void)increment:(double)amount;
Parameters
amount
The amount to increment the counter by. This can be a positive or a negative value.
-
Push a value on to the end of an array at the document’s key defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an array.
Declaration
Objective-C
- (void)push:(nonnull id)value;
Parameters
value
The value to push on to the array.
-
Pop a value off the end of an array at the document’s key defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an array.
Declaration
Objective-C
- (nullable id)pop;
Return Value
The value popped off from the end of the array.
-
Inserts a value into an array at the index defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an index into an array.
Declaration
Objective-C
- (void)insert:(nonnull id)value;
Parameters
value
The value to insert into the array.