title: How to implement didReceiveMemoryWarning in Swift?
body: <p>Whenever I create a new View Controller subclass, Xcode automatically adds the method</p>
  
  <pre><code>override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated
  }
  </code></pre>
  
  <p>Usually I just delete it or ignore it. This is what all the tutorials I have seen do, too. But I assume that since Xcode gives it to me every time, it should be somewhat important, right? What should I be doing here? I assume that disposing of resources means setting them to nil, but what exactly are "resources that can be recreated"?</p>
  
  <p>I have seen these questions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/2430728/how-to-implement-didreceivememorywarning">How to implement didReceiveMemoryWarning?</a></li>
  <li><a href="https://stackoverflow.com/questions/7766581/uiviewcontrollers-didreceivememorywarning-in-arc-environment">UIViewController&#39;s didReceiveMemoryWarning in ARC environment</a></li>
  <li><a href="https://stackoverflow.com/questions/491075/iphone-development-simulate-memory-warning">iPhone Development - Simulate Memory Warning</a></li>
  </ul>
  
  <p>But they are all pre-Swift. Although I don't know much about Objective-C, I have heard that the memory management is different. How does that affect what I should do in <code>didReceiveMemoryWarning</code>?</p>
  
  <p>Other notes:</p>
  
  <ul>
  <li>I am fuzzily aware of Automatic Reference Counting and lazy instantiation</li>
  <li>The <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/#//apple_ref/occ/instm/UIViewController/didReceiveMemoryWarning" rel="noreferrer">documentation</a> on <code>didReceiveMemoryWarning</code> that I found was rather brief.</li>
  </ul>