Category Archives: iOS

Niagara Border Crossing app released for iPhone

img_20160927_172242The Niagara Border Crossing app has been released for iPhones in the iTunes app store This app shows wait times for border crossings over the Niagara River between the United States and Canada, and is also available for Android, BlackBerry, and Windows users.

Wait times are shown for all four of the bridges between Western New York and Southern Ontario. These include the Lewiston-Queenston Bridge, the Whirlpool Rapids Bridge, the Rainbow Bridge, and the Peace Bridge. Separate times are shown for cars, trucks, and also for those using the Nexus lanes.

Links & Information

icon480

Getting website text in Swift 3

Last month I noted that Swift 2 had not yet dropped its Objective-C origins when it came to retrieving website text. Fortunately, Swift 3 has great advances in this area. Getting source of a webpage is now a simple and straightforwards process…

let url:NSURL = NSURL(string: "http://ebscer.com")!
do
{
    let responseText:String = try String(contentsOf:url,
                            encoding:String.Encoding.utf8)
}
catch let error
{
    print("Error: \(error)")
}

Getting web site text in Swift 2

Update: This process has been simplified for Swift 3

Loading the text of a webpage in Swift has not completely dropped its Objective-C origins, which makes the process a little bit less obvious than it should be. Fortunately it is only a few lines…

let url:NSURL = NSURL(string: "http://ebscer.com")!
let request:NSURLRequest = NSURLRequest(URL: url)
NSURLConnection.sendAsynchronousRequest(request, 
    queue: NSOperationQueue(),
    completionHandler: { (response:NSURLResponse?,
        data: NSData? error: NSError?) -> Void in
            let responseText:String = String(data: data!,
                encoding: NSUTF8StringEncoding)!
            print(responseText)
    })

You may also need to edit your plist file to whitelist the domain.