override func viewDidLoad() {
// function calling
querySomething { (completed) in
print("completed :", completed)
}
}
func querySomething(completion: @escaping (Bool) -> Void) {
let db = Firestore.firestore()
db.collection("collectionName").document().addSnapshotListener { (documentSnapshot, error) in
if error != nil {
completion(false)
return
}
completion(true)
}
}