I am creating a swift class which contain of a function which validate if the user is true. However, the userVerifyResult
will always return \"false\" even if t
Use completion handler, as Apple does in their frameworks:
func verifyUser(completionHandler: ((result: Bool)->())) {
then return the result via
if(json["valid"]! == "true"){
completionHandler(result: true)
}else{
completionHandler(result: false)
}
then invoke it as
verifyUser { (result) -> () in
println(result)
}