Created
August 28, 2020 04:39
-
-
Save nugmanoff/d73423e9b754c2f45781310fe6413da2 to your computer and use it in GitHub Desktop.
Decoding query documents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Firestore.firestore().collection("Portfolio").getDocuments() { query, error in | |
if let documents = query.documents { | |
let portfolios: [HistoryCompany] = documents.map { document in | |
return try! FirestoreDecoder().decode(HistoryCompany.self, from: document.data() | |
} | |
} else { | |
print("Document does not exist") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment