     ac.addAction(UIAlertAction(title: "loopinsight.com", style: .Default, handler: openPage))
     ac.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
     
-    if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Pad {
+    if UIDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
       ac.modalPresentationStyle = .Popover
       ac.popoverPresentationController!.barButtonItem = navigationItem.rightBarButtonItem
     }

    webView.loadRequest(NSURLRequest(URL: url))
  }
  
}

extension ViewController: WKNavigationDelegate {

    webView.allowsBackForwardNavigationGestures = true
    
    navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Open", style: .Plain, target: self, action: "openTapped")
    let spacer = UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: nil, action: nil)
    let refresh = UIBarButtonItem(barButtonSystemItem: .Refresh, target: self, action: "refreshTapped")
    
    toolbarItems = [spacer, refresh]
    navigationController?.toolbarHidden = false
  }
  
  override func didReceiveMemoryWarning() {
