title: Swift WKWebView crash on didFailProvisionalNavigation
body: <p>We are encountering an intermittent (happens on some devices, some of the time) crash that we are having a hard time nailing down, and are unable to reproduce on-demand.  This is related to Swift 3 and the WKWebView component, specifically its callback protocol crashes when attempting to get the error code via a switch statement.  see below:</p>
  
  <pre><code>func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
  
    if let err = error as? URLError {
  
      switch(err.code) {  //  Exception occurs on this line
      case .cancelled:
        Hint(hide: true)
  
      case .cannotFindHost:
        Hint(hide: false, hint:.CannotFindHost)
  
      case .notConnectedToInternet:
        Hint(hide: false, hint: .NoInternet)
  
      case .resourceUnavailable:
        Hint(hide: false)
  
      case .timedOut:
        Hint(hide: false)
  
      default:
        Hint(hide: false)
        print("error code: " + String(describing: err.code) + "  does not fall under known failures")
      }
    }
  }
  
  func Hint(hide: Bool, hint:SomeCustomEnum = SomeCustomEnum.Default) {
       //Dosomething with ui to let user know something bad happened
  }
  </code></pre>
  
  <p>the error stack indicates:</p>
  
  <p>0 _BridgedStoredNSError.code.getter</p>
  
  <p>1 _BridgedStoredNSError.code.getter</p>
  
  <p>2 specialized WebKitController.webView(WKWebView, didFailProvisionalNavigation : WKNavigation!, withError : Error) -> ()</p>
  
  <p>3 @obj WebKitController.webView(WKWebView, didFailProvisionalNavigation : WKNavigation!, withError : Error) -> ()</p>
  
  <p>...</p>
  
  <p>Reviewing the code it seems as if it should be effectively free from issues since the variable err should be successfully optionally-unwrapped as a valid URLError object by the time the switch statement is invoked.  The switch statement at that point should be guaranteed a value in err.code since   .code is not optional for URLError.</p>
  
  <p>Attempts to artificially cause an error that might explain the issue have so far not provided much insight.  ie. if I create my own custom error without a code property, then attempt to cast that as a URLError, it gracefully falls out of the optional assignment.</p>
  
  <p>Any help or suggestions to revolve or even further troubleshoot is appreciated, in the mean time will continue to try to reproduce on a consistent basis.</p>