FirebaseFirestoreSwift Framework Reference

DocumentSnapshot

public extension DocumentSnapshot
  • Retrieves all fields in a document and converts them to an instance of caller-specified type.

    By default, server-provided timestamps that have not yet been set to their final value will be returned as NSNull. Pass serverTimestampBehavior to configure this behavior.

    See Firestore.Decoder for more details about the decoding process.

    Declaration

    Swift

    func data<T: Decodable>(as type: T.Type,
                            with serverTimestampBehavior: ServerTimestampBehavior = .none,
                            decoder: Firestore.Decoder = .init()) throws -> T