Open hixfield opened 6 years ago
Well, Firestore documentation is a bit different.
FirestoreManager.shared.db.collection("data").getDocuments { documents, error in
if let documents = documents {
for document in documents.documents {
guard let model = try? FirestoreDecoder().decode(Model.self, from: document.data()) else { print("Error"); return }
print("Model: \(model.name), \(model.email), \(model.location), \(model.details.dealbreakers)")
}
} else {
print("Document does not exist")
}
}
Don’t understand can you ellaborate?
If I use the sample code it crashes with "Terminating app due to uncaught exception 'InvalidFirebaseData', reason: '(nodeFrom:priority:) Cannot store object of type _SwiftValue at . Can only store objects of type NSNumber, NSString, NSDictionary, and NSArray."
I believe the usage of setValue is wrong, if I change it to updateChildValues is works perfectly. However, issue is that updateChildeValues will not replace the whole data under the key which I need (and that is why I wanted to use setValue).