Component - Cloud Firestore
This UI component shows a simple list of items fetched from Cloud Firestore, a cloud database. It displays data in a scrollable list and updates automatically when the data changes in the cloud.
This UI component shows a simple list of items fetched from Cloud Firestore, a cloud database. It displays data in a scrollable list and updates automatically when the data changes in the cloud.
UIViewController ├── UITableView │ └── UITableViewCell (repeated for each document)
let docRef = Firestore.firestore().collection("users").document("user123")
docRef.getDocument { document, error in
if let document = document, document.exists {
let name = document.data()?["name"] as? String ?? "Unknown"
print(name)
} else {
print("No document")
}
}let docRef = Firestore.firestore().collection("users").document("user123")
docRef.getDocument { document, error in
if error != nil {
print("Error fetching document")
}
if let document = document, document.exists {
print(document.data())
}
}Pass the test and this pattern moves unknown