 class ViewController: UIViewController {
   
   var webView: WKWebView!
+  var progressView: UIProgressView!
   
   override func loadView() {
     webView = WKWebView()

    UIApplication.sharedApplication().networkActivityIndicatorVisible = true
    webView.reload()
  }
}

extension ViewController: WKNavigationDelegate {

    let url = NSURL(string: "http://www.starfall.com")!
    webView.loadRequest(NSURLRequest(URL: url))
    webView.allowsBackForwardNavigationGestures = true
    webView.addObserver(self, forKeyPath: "estimatedProgress", options: .New, context: nil)
    
    navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Open", style: .Plain, target: self, action: "openTapped")
    progressView = UIProgressView(progressViewStyle: .Default) // or .Bar
    progressView.sizeToFit()
    let progressButton = UIBarButtonItem(customView: progressView)
    let spacer = UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: nil, action: nil)
    let refresh = UIBarButtonItem(barButtonSystemItem: .Refresh, target: self, action: "refreshTapped")
    
    toolbarItems = [progressButton, spacer, refresh]
    navigationController?.toolbarHidden = false
  }
  
