Возможно, вам нужно использовать .childAdded
для циклического прохождения всех узлов в этой коллекции.
Обновление
1 - этот код будет извлекать пользователей из вашего каталога root
:
func fetchRoot() {
refRepairs!.child(UserID ?? "No User ID").observe(.childAdded, with: { (snapshot) in
// Get Every user
let userID = snapshot.key
// Pass the users key
self.fetchUsers(userID: userID)
})
}
}
2- Этот код будет считать каждый узел внутри users
:
func fetchUsers(userID: String) {
refRepairs!.child(userID).observeSingleEvent(of: .value, with: { (snapshot) in
//// Attempt to fetch the number of projects
let num = snapshot.childrenCount
print("SnapShot Child Number: \(num) -- For User: \(userID)")
})
}
}