title: How can I store a Swift enum value in NSUserDefaults
body: <p>I have an enum like this:</p>
  
  <pre><code>enum Environment {
      case Production
      case Staging
      case Dev
  }
  </code></pre>
  
  <p>And I'd like to save an instance in NSUserDefaults like this:</p>
  
  <pre><code>func saveEnvironment(environment : Environment){
      NSUserDefaults.standardUserDefaults().setObject(environment, forKey: kSavedEnvironmentDefaultsKey)
  }
  </code></pre>
  
  <p>I understand that a Swift enum isn't an NSObject, and that makes it difficult to save, but I'm unsure what the best way is to convert it to something storable.</p>