title: How can I set the "User-Agent" header of a UIWebView in Swift
body: <p>I am using Xcode 6 for an iOS App with Swift. I have got a simple ViewController with an embedded UIWebView. You can find the code below. Now I want to change the <code>User-Agent</code> HTTP header. I tried to use the <code>setValue</code> method of <code>NSURLRequest</code> but it didn't work (see uncommented line). Does anyone know how to do that?</p>
  
  <pre><code>import UIKit
  
  class WebViewController: UIViewController {
  
      @IBOutlet weak var webView: UIWebView!
  
      override func viewDidAppear(animated: Bool) {
          var url = NSURL(string: "https://www.samplepage.com")
  
          var request = NSMutableURLRequest(URL: url)
  
          // request.setValue("Custom-Agent", forHTTPHeaderField: "User-Agent")
  
          webView.loadRequest(request)
      }
  }
  </code></pre>