How To check response.statusCode in SendSynchronousRequest in Swift The Code is Below :
let urlPath: String = "URL_IS_HERE"
var url: NSURL = NSURL(string: urlPath)
var request: NSURLRequest = NSURLRequest(URL: url)
var response: AutoreleasingUnsafeMutablePointer<NSURLResponse?> = nil
var error: NSErrorPointer? = nil
var data = NSURLConnection.sendSynchronousRequest(request, returningResponse: response, error: nil) as NSData?
before and in objective c , we check response.statusCode With this : (long)response.statusCode but in swift i have no idea how can check response status Code
if
andlet
statements toif let httpResponse = response as? NSHTTPURLResponse { ... }
. – Washy