DittoDocument

public class DittoDocument
extension DittoDocument: CustomStringConvertible, CustomDebugStringConvertible
extension DittoDocument: Identifiable

A document belonging to a DittoCollection with an inner value.

  • id

    The ID of the document.

    Declaration

    Swift

    public let id: DittoDocumentID
  • The document’s inner value.

    Declaration

    Swift

    public private(set) lazy var value: [String : Any?] { get set }
  • 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 initial 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.

  • Return a typed document where the document’s inner value is decoded into an object of the provided type.

    Throws

    DittoSwiftError.

    Precondition

    The type provided must conform to Codable.

    Declaration

    Swift

    public func typed<T>(as type: T.Type) throws -> DittoTypedDocument<T> where T : Decodable, T : Encodable

    Parameters

    type

    The type to use to decode the document’s inner value.

    Return Value

    A DittoTypedDocument whose inner value has been decoded into an object of the provided type.

CustomStringConvertible & CustomDebugStringConvertible

  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public var debugDescription: String { get }