0
저는 데이터베이스에 FirebaseFirestore를 사용하고 있습니다.Swift Firestore 자료 가져 오기 ID
나는 이름과 설명이있는 목록의 배열을 가지고 있습니다. 고유 한 documentId 각각의 목록을 가져오고 싶습니다. 이것이 가능한가?
List.swift
struct List {
var name:String
var description:String
var dictionary:[String:Any] {
return [
"name":name,
"description":description
]
}
}
난 당신이 수행하여 documentId를 얻을 수 있습니다 발견
func getLists() {
if Auth.auth().currentUser != nil {
db.collection("lists").getDocuments { (querySnapshot, error) in
if let error = error {
print("Error getting documents: \(error)")
} else {
self.listArray = querySnapshot!.documents.flatMap({List(dictionary: $0.data())})
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
}
}
}
ListTableViewController.swift ...
for document in querySnapshot!.documents {
print("\(document.documentID) => \(document.data())")
}
하지만이 어떻게 저장합니까 나중에 전화 할 수있는 나의 목록?