DittoDocumentIDPath

public struct DittoDocumentIDPath

Provides an interface to specify a path to a key in a document ID that you can then call a function on to get the value at the specified key as a specific type. You obtain a DittoDocumentIDPath by subscripting a DittoDocumentID and you can then further subscript a DittoDocumentIDPath to further specify the key of the document ID that you want to get the value of. This is only really useful if you’re working with a document ID whose underlying value is a dictionary or an array.

Subscripting

  • Used to specify a path to a key in the document ID that you can subscript further to access a nested key in the document ID.

    Declaration

    Swift

    public subscript(key: String) -> DittoDocumentIDPath { get }

    Parameters

    key

    The next part of the path needed to get to the key in the document ID you wish to get the value of.

    Return Value

    The same DittoDocumentIDPath object with the provided key incorporated into the document ID 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 ID.

    Declaration

    Swift

    public subscript(index: Int) -> DittoDocumentIDPath { 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 DittoDocumentIDPath object with the provided index incorporated into the document ID path.

Value Accessors

  • Returns the value at the previously specified key in the document ID as an Any?. It will be nil if no value exists.

    Declaration

    Swift

    public var value: Any? { get }
  • Returns the value at the previously specified key in the document ID as a String if possible, otherwise the return value will be nil.

    Declaration

    Swift

    public var string: String? { get }
  • Returns the value at the previously specified key in the document ID 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 ID as a Bool if possible, otherwise the return value will be nil.

    Declaration

    Swift

    public var bool: Bool? { 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 boolValue: Bool { get }
  • int

    Returns the value at the previously specified key in the document ID as an Int if possible, otherwise the return value will be nil.

    Declaration

    Swift

    public var int: Int? { get }
  • Returns the value at the previously specified key in the document ID 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 ID as a UInt if possible, otherwise the return value will be nil.

    Declaration

    Swift

    public var uint: UInt? { get }
  • Returns the value at the previously specified key in the document ID 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 ID as an Array<Any?> if possible, otherwise the return value will be nil.

    Declaration

    Swift

    public var array: [Any?]? { get }
  • Returns the value at the previously specified key in the document ID 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 ID as a Dictionary<String, Any?> if possible, otherwise the return value will be nil.

    Declaration

    Swift

    public var dictionary: [String : Any?]? { get }
  • Returns the value at the previously specified key in the document ID 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 }