DittoDocumentPath
public struct DittoDocumentPath
Provides an interface to specify a path to a key in a document that you can then call a function on to get
the value at the specified key as a specific type. You obtain a DittoDocumentPath
by subscripting a
DittoDocument
and you can then further subscript a DittoDocumentPath
to further specify the key of
the document that you want to get the value of.
-
Used to specify a path to a key in the document that you can subscript further to access a nested key in the document.
Declaration
Swift
public subscript(key: String) -> DittoDocumentPath { get }
Parameters
key
The next part of the path needed to get to the key in the document you wish to get the value of.
Return Value
The same
DittoDocumentPath
object with the provided key incorporated into the document 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.
Declaration
Swift
public subscript(index: Int) -> DittoDocumentPath { get }
Parameters
index
The index of the array that you wish to access in the key previously specified with the preceding subscripting.
Return Value
The same
DittoDocumentPath
object with the provided index incorporated into the document path.
-
Returns the value at the previously specified key in the document as an
Any?
. It will benil
if no value exists.Declaration
Swift
public var value: Any? { get }
-
Returns the value at the previously specified key in the document as a
String
if possible, otherwise the return value will benil
.Declaration
Swift
public var string: String? { get }
-
Returns the value at the previously specified key in the document as a
String
. If the key was invalid the return value will be an empty string.Declaration
Swift
public var stringValue: String { get }
-
Returns the value at the previously specified key in the document as a
Bool
if possible, otherwise the return value will benil
.Declaration
Swift
public var bool: Bool? { get }
-
Returns the value at the previously specified key in the document as a
Bool
. If the key was invalid the return value willfalse
.Declaration
Swift
public var boolValue: Bool { get }
-
Returns the value at the previously specified key in the document as an
Int
if possible, otherwise the return value will benil
.Declaration
Swift
public var int: Int? { get }
-
Returns the value at the previously specified key in the document as an
Int
. If the key was invalid the return value will be 0.Declaration
Swift
public var intValue: Int { get }
-
Returns the value at the previously specified key in the document as a
UInt
if possible, otherwise the return value will benil
.Declaration
Swift
public var uint: UInt? { get }
-
Returns the value at the previously specified key in the document as a
UInt
. If the key was invalid the return value will be 0.Declaration
Swift
public var uintValue: UInt { get }
-
Returns the value at the previously specified key in the document as a
Float
if possible, otherwise the return value will benil
.Declaration
Swift
public var float: Float? { get }
-
Returns the value at the previously specified key in the document as a
Float
. If the key was invalid the return value will be 0.Declaration
Swift
public var floatValue: Float { get }
-
Returns the value at the previously specified key in the document as a
Double
if possible, otherwise the return value will benil
.Declaration
Swift
public var double: Double? { get }
-
Returns the value at the previously specified key in the document as a
Double
. If the key was invalid the return value will be 0.Declaration
Swift
public var doubleValue: Double { get }
-
Returns the value at the previously specified key in the document as an
Array<Any?>
if possible, otherwise the return value will benil
.Declaration
Swift
public var array: [Any?]? { get }
-
Returns the value at the previously specified key in the document as an
Array<Any?>
. If the key was invalid the return value will be an empty array.Declaration
Swift
public var arrayValue: [Any?] { get }
-
Returns the value at the previously specified key in the document as a
Dictionary<String, Any?>
if possible, otherwise the return value will benil
.Declaration
Swift
public var dictionary: [String : Any?]? { get }
-
Returns the value at the previously specified key in the document as a
Dictionary<String, Any?>
. If the key was invalid the return value will be an empty dictionary.Declaration
Swift
public var dictionaryValue: [String : Any?] { get }
-
Returns the value at the previously specified key in the document as a
DittoAttachmentToken
if possible, otherwise the return value will benil
.Declaration
Swift
public var attachmentToken: DittoAttachmentToken? { get }