Can Swift return value from an async Void-returning block?
问题 I want to create a function to check if user_id is already in my database. class func checkIfUserExsits(uid:String) -> Bool { userRef.childByAppendingPath(uid).observeSingleEventOfType(.Value, withBlock: { (snapShot: FDataSnapshot!) -> Void in if snapShot.value is NSNull { return false } else { return true } }) } However, observeSingleEventOfType is a API provided by 3rd party Firebase. It is defined to return Void . (void)observeSingleEventOfType:(FEventType)eventType withBlock:(void ( ^ ) (