title: How can I encrypt my data using apple's data protection API?
body: <p>I'd like to encrypt all data saved on the users phone unless the data is needed for a notification. After looking at apple's documentation <code>NSFileProtectionCompleteUnlessOpen</code> looks to be what I need for data used in notifications and <code>NSFileProtectionComplete</code> should do for data not needed for notifications.</p>
  
  <p>I'm aware these are attributes within <code>NSFileManager</code> but I'm unfamiliar with this class and do not want to get this wrong. I've searched for the createDirectory function calls that will allow me to change the fileProtectionAttributes when creating a new file but it appears our files come from a different source so I need a way of setting the fileProtection attributes from an existing directory.</p>
  
  <p>I'm using swift 2 and iOS 8</p>
  
  <pre><code>let files = NSFileManager.defaultManager().enumeratorAtURL(CallIn.DocumentDirectoryURL, includingPropertiesForKeys: nil, options: NSDirectoryEnumerationOptions(), errorHandler: nil)
  </code></pre>