I was wondering how to make a completion handler for a function I'm creating in Swift 3.
This is how I did my function right before I updated to Swift 3:
func Logout(completionHandler: (success: Bool) -> ()) {
backendless.userService.logout(
{ ( user : AnyObject!) -> () in
print("User logged out.")
completionHandler(success: true)
},
error: { ( fault : Fault!) -> () in
print("Server reported an error: (fault)")
completionHandler(success: false)
})}
But now I can't figure out the best approach that works right now.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…