title: Scaling UIwebview swift
body: <p>I am trying to scale the UIWebView content to the screen of the simulator. However, I can not manage to figure out how to scale the content to the respective IOS device. I have tried a variety of things to change the scaling of the content, but can not find anything on other pages. I am also NOT using storyboards for this project. I am using direct code to make constraints for the app. Here is the code for the UIWebView</p>
  
  <pre><code>func handleDownload() {
      //print(123)
      let webView = UIWebView (frame: view.frame)
      webView.backgroundColor = UIColor.redColor()
      view.addSubview(webView)
      webView.loadRequest(NSURLRequest(URL: NSURL(string: "https://storage.com")!))
  
  
  
  }
  </code></pre>
  
  <p>I have tried using this code:</p>
  
  <pre><code>func zoomToFit() {
  if theWebView.respondsToSelector(#selector(self.scrollView)) {
      var scrollView: UIScrollView = theWebView.scrollView()
      var zoom: Float = theWebView.bounds.size.width /   scrollView.contentSize.width
      scrollView.minimumZoomScale = zoom
      scrollView.setZoomScale(zoom, animated: true)
     }
  }
  </code></pre>
  
  <p>This doesnt seem to work.. </p>
  
  <p>Thank You!</p>