let db = Firestore.firestore()
db.collection("Users").getDocuments { snapshot, error in
//check for errors
if error == nil {
//no error
if let snapshot = snapshot {
//get all docs
for doc in snapshot.documents {
self.users.append(UserModel(doc.documentID,
doc["Username"] as! String,
doc["Password"] as! String,
doc["Email"] as! String))
}
}
} else {
//handle
}
The snapshot variable doesn’t seem to load all the documents into it. Anyone notice an issue with the code as to why?