title: NSCache in Swift : does not save to disk
body: <p>I don't know what I am missing here to cache object. But no object is ever cached in the disk</p>
  
  <pre><code>import UIKit
  
  class MyObject {
      var title:String?
      var desc:String?
  
      init(title: String, desc: String) {
          self.title = title
          self.desc = desc
      }
  }
  
  class ViewController: UIViewController {
  
      let cache = NSCache&lt;NSString, MyObject&gt;()
      var myObject:MyObject?
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          if let cachedVersion = cache.object(forKey: "CachedObject") {
              // use the cached version
              myObject = cachedVersion
          } else {
              // create it from scratch then store in cache
              let object = MyObject(title: "title", desc: "desc")
              cache.setObject(object, forKey: "CachedObject")
          }
      }
  }
  </code></pre>
  
  <p>After running the Xcode project the 2nd time around, I would expect to see a value for the key "CachedObject"</p>
  
  <p><a href="https://i.stack.imgur.com/NUFhV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NUFhV.png" alt="enter image description here"></a></p>