I have the following function. It runs in ViewDidLoad(). I am trying to add some error handling to an iPhone app for non-connectivity. Essentially, I want the program to check if the URLrequest can connect to its target URL and print the appropriate text to the console.
I have found some previous questions that address the problem in obj C, but I can't find any good info for how to do it in Swift. Any help?
func loadURL(){
let requestURL = NSURL(string: path)
let request = NSURLRequest(URL: requestURL!)
if(/* ??? */){
webViewer.loadRequest(request)
println("Good connection")
}
else{
println("No connection")
}
}