DittoDocument
public class DittoDocument
extension DittoDocument: CustomStringConvertible, CustomDebugStringConvertible
extension DittoDocument: Identifiable
A document belonging to a DittoCollection
with an inner value.
-
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 }
-
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 toCodable
.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. -
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.
-
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public var debugDescription: String { get }