Skip to content

Instantly share code, notes, and snippets.

@nugmanoff
Created August 28, 2020 04:39
Show Gist options
  • Save nugmanoff/d73423e9b754c2f45781310fe6413da2 to your computer and use it in GitHub Desktop.
Save nugmanoff/d73423e9b754c2f45781310fe6413da2 to your computer and use it in GitHub Desktop.
Decoding query documents
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