Q: Swift JSON result compare to string I'm developing iOS app that needs to request JSON for username/password validation. I found and used Alamofire framework. If I debug this app, the print show 1, but the the condition is evaluated as true (var ok is never true).
static func userPasswordCheck(username:String,password: String) -> Bool{
    var ok = false
    Alamofire.request(.GET, "https://is.xxxxxxx.com/api/login?username="+username+"&password="+password)
        .responseJSON { response in
                if let JSON = response.result.value {
                    print(String(JSON["responseCode"]!!.description))
                    if(String(JSON["responseCode"]!!.description)=="1"){
                        ok =  true
                    }
                }
    }
    return ok
}

