Im currently using firebase to retrieve user info. once I receive the data I want to use the data outside of all closure the I create a completion block the problem is that I can not add the completion variable to the result because the result is inside another closure. How can fix this problem. Thank you in advance for the help.
func userInfo(userId:String,completion:(result:String)->Void){
fireBaseAPI().childRef("version_one/frontEnd/users/\(fireBaseAPI().currentUserId()!)/email").observeEventType(.Value, withBlock: {snapshot in
let email = snapshot.value as! String
//this is incorrect because it is inside a firebase closure how can I make it work I know i have it outside the closure but i will not be able to retrieve the info from firebase
result = email
})
}