FirebaseFirestoreSwift Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
-
-
Returns an instance of specified type from a Firestore document.
If exists in container
, Firestore specific types are recognized, and
passed through to Decodable
implementations. This means types below
in container
are directly supported:
- GeoPoint
- Timestamp
DocumentReference
A type to decode a document to.
container: A Map keyed of String representing a Firestore document.
document: A reference to the Firestore Document that is being
decoded.
Declaration
Swift
public func decode<T: Decodable>(_: T.Type,
from container: Any,
in document: DocumentReference? = nil) throws -> T
Parameters
container
|
A Map keyed of String representing a Firestore document.
|
document
|
A reference to the Firestore Document that is being
decoded.
|
Return Value
An instance of specified type by the first parameter.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-05-11 UTC.
[null,null,["Last updated 2022-05-11 UTC."],[],[],null,["# FirebaseFirestoreSwift Framework Reference\n\nDecoder\n=======\n\n struct Decoder\n\nUndocumented\n- `\n ``\n ``\n `\n\n ### [init()](#/s:So12FIRFirestoreC22FirebaseFirestoreSwiftE7DecoderVAEycfc)\n\n `\n ` \n Undocumented \n\n #### Declaration\n\n Swift \n\n public init()\n\n- `\n ``\n ``\n `\n\n ### [decode(_:from:in:)](#/s:So12FIRFirestoreC22FirebaseFirestoreSwiftE7DecoderV6decode_4from2inxxm_ypSo20FIRDocumentReferenceCSgtKSeRzlF)\n\n `\n ` \n Returns an instance of specified type from a Firestore document.\n\n If exists in `container`, Firestore specific types are recognized, and\n passed through to `Decodable` implementations. This means types below\n in `container` are directly supported:\n - GeoPoint\n - Timestamp\n - DocumentReference\n\n - A type to decode a document to.\n\n - container: A Map keyed of String representing a Firestore document.\n\n - document: A reference to the Firestore Document that is being\n decoded.\n\n #### Declaration\n\n Swift \n\n public func decode\u003cT: Decodable\u003e(_: T.Type,\n from container: Any,\n in document: DocumentReference? = nil) throws -\u003e T\n\n #### Parameters\n\n |-------------------|--------------------------------------------------------------|\n | ` `*container*` ` | A Map keyed of String representing a Firestore document. |\n | ` `*document*` ` | A reference to the Firestore Document that is being decoded. |\n\n #### Return Value\n\n An instance of specified type by the first parameter."]]