title: What is the best option for saving lots of coded UITextField text: NSCoding or NSUserDefaults?
body: <p>I have an iOS project I'm working on using Xcode 7.3.1 and Swift2.  In my project are 30 coded <code>UITextFields</code>, each with an assigned <code>action</code> for it.  I am also using the <code>UITextFieldDelegate</code>.  After the user enters text, I want the text to be saved.  I've searched in here for answers as to the best location to place the save code.  I don't want this project to be taxing on the device's memory.  Is it better to save the text using an <code>NSObject</code> and <code>NSCoding</code>, something like:</p>
  
  <pre><code>class TextFieldSave: NSObject, NSCoding {
  
      var userText: String = ""
      var textFieldName: String = ""
  
      ...
  }
  </code></pre>
  
  <p>I could then save the name of the <code>textField</code> that the text was stored in and save via <code>NSCoding</code>.</p>
  
  <p>OR would it be less memory to simply save with <code>NSUserDefaults</code>?</p>
  
  <p>I could put the saving code in the action of each <code>textField</code> or somehow incorporate all 30 of them in the <code>textFieldDidEndEditing</code> section of the <code>delegate</code>.  Not sure which is best.  I think <code>NSUserDefaults</code> is the simplest, but not necessary the best for memory usage.</p>
  
  <p>Thank you for your advice and help.</p>