 import WebKit
 
 protocol WebViewControllerNavigationDelegate {
-    func visitLocation(URL: NSURL!)
-    func locationDidChange(URL: NSURL!)
+    func visitLocation(URL: NSURL)
+    func locationDidChange(URL: NSURL)
 }
 
 class WebViewController: UIViewController, WebViewControllerNavigationDelegate {

        var delegate: WebViewControllerNavigationDelegate?

        func userContentController(userContentController: WKUserContentController, didReceiveScriptMessage message: WKScriptMessage) {
            if let body = message.body as? [String: AnyObject] {
                var name = body["name"] as? String
                var data = body["data"] as? String

                switch name! {
                case "visitLocation":
                    self.delegate?.visitLocation(NSURL(string: data!))
                case "locationChanged":
                    self.delegate?.locationDidChange(NSURL(string: data!))
                default:
                    println("Unhandled message: \(name): \(data)")
                }
            }
        }
    }

    var URL = NSURL(string: "http://turbolinks.dev/")
    var activeSessionTask: NSURLSessionTask?

    static let sharedWebView: WKWebView = {


    private func loadRequest() {
        if webView.URL == nil {
            let request = NSURLRequest(URL: URL)
            webView.loadRequest(request)
        }
    }
