title: UIProgressView loading bar with percentage
body: <p>I want to make a loading bar in Swift 3 for my iOS project. I'm doing a web view for the moment and need to do this loading bar to show in between the actions. I know it is fake loading bar and I saw code in Objective-C and tried to make something out of it in Swift but I'm afraid that my logic is wrong, since I'm new in Swift.</p>
  
  <p>The problem I'm having is that I don't acctually know if I set vars <code>theBool</code> and <code>timer</code> to the right place and I dont know how to use <code>Timer()</code>. </p>
  
  <p>And to tell you what I see when I run the app, Progress bar is showing the whole time, but it's not loading.</p>
  
  <p>This is my code so far</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
      @IBOutlet weak var webView: UIWebView!
      @IBOutlet weak var progressView: UIProgressView!
  
      var theBool = false
      var timer = Timer()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          progressView.progress = 0.0
  
          //Reading the webview
          let websiteURL = URL(string: "http://google.com")
          let websiteURLRequest = URLRequest(url: websiteURL!)
          webView.loadRequest(websiteURLRequest)
      }
  
      func webViewDidFinishLoad (){
          if webView.isLoading == true {
          theBool = true
          }
      }
  
      func handleProgress () {
          if (theBool){
              if (progressView.progress &gt;= 1) {
                  progressView.isHidden = true
                  timer.invalidate()
              } else {
                  progressView.progress += 0.1
              }
          } else {
              progressView.progress += 0.05
              if (progressView.progress &gt;= 0.95) {
                  progressView.progress = 0.95
              }
          }
      }
  
      /*
      func addValsToProgress () -&gt;String {
          if (webViewLoading() == true) {
              view.progressView.setProgre
          }
      }
      */
  }
  </code></pre>