title: Request desktop site WKWebview not working in Swift 4
body: <p>I tried almost everything one stackoverflow and other site to request desktop version of site in WKWebview, but none of solution is working for me.</p>
  
  <p>my tried links as below</p>
  
  <p><a href="https://stackoverflow.com/a/38228810/3145189">https://stackoverflow.com/a/38228810/3145189</a></p>
  
  <p><a href="https://stackoverflow.com/a/38228810/3145189">https://stackoverflow.com/a/38228810/3145189</a></p>
  
  <p><a href="https://stackoverflow.com/a/49646773/3145189">https://stackoverflow.com/a/49646773/3145189</a></p>
  
  <p><a href="https://stackoverflow.com/a/48155481/3145189">https://stackoverflow.com/a/48155481/3145189</a></p>
  
  <p>i tried on above threads to get answers by commenting on answers, but got no reply so here i go with my question, i hope you won't mark it duplicate</p>
  
  <p>Here is my one of implementation out of many i tried</p>
  
  <pre><code>import UIKit
  import WebKit
  
  class ViewController: UIViewController {
      var webview: WKWebView!
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
  
          let config = WKWebViewConfiguration()
          webview = WKWebView(frame: self.view.frame, configuration: config)
          self.webview.uiDelegate = self
  
  
          let url = URL(string: "https://quora.com/")!
          var request = URLRequest(url: url)
          let userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36"
          request.addValue(userAgent, forHTTPHeaderField: "User-Agent")
          webview.load(request)
  
          //webview.customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36"
          self.view.addSubview(webview)
  
      }
  }
  
  extension ViewController: WKUIDelegate {
  }
  </code></pre>
  
  <p>I would request, please test you answer or suggestion before posting answer, as i have tried so many other things.</p>
  
  <p><strong>Edit-</strong> </p>
  
  <p>Above sample code is working fine, problem is changing user-agent don't reflect immediately, on reinstallation user-agent change does reflect, so my question is how to toggle request desktop site by using button. </p>