When Firebase function ends in Swift
问题 I am using a Firebase in my app, it queries through a lot of users and gets the specific data that is needed, but when it starts querying - the rest of the function keep running too, instead of just querying so I can't understand when it ends. For example in this code: ref.observeEventType(.ChildAdded, withBlock: { snapshot in let user = snapshot.value!.objectForKey("User") let name = (user!["Name"])! as! String print("name") }) print("done") Let's say we have 3 users in the Firebase Database