title: How do I properly cache a NSURLRequest in swift?
body: <p>Forgive if this has been asked but I've done heavy searching and can't seem to find an answer I'm looking for in swift. I have a <code>UIWebView</code> that loads PDF files and I wouldn't want the user to go through a tedious loading process again if they exit the WebView and come back, so how do I cache a request to make the loading quicker? </p>
  
  <p>Here is my code:</p>
  
  <pre><code>var contentUrlPassedOn: String!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          myWebView.delegate = self
  
          let url: NSURL! = NSURL(string: contentUrlPassedOn)
  
          myWebView.loadRequest(NSURLRequest(URL: url))
          var request: NSURLRequest
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>What I am trying to accomplish can be seen in <a href="https://www.dropbox.com/s/2es7vg809vi8b22/cache.mov?dl=0" rel="nofollow">this video</a></p>
  
  <p>that is an example of dropbox's iOS app. When one of the files have been already loaded, every other trip into that file ( in this case PDF) will be quick and easy. This method is exactly what I am trying to replicate.</p>
  
  <p>any suggestions?</p>