title: How to integrate enums in propertyWrapped UserDefault
body: <p>The struct below will work for primitive data types such as <code>Int</code>, <code>String</code>, <code>Double</code>, etc., Is there a way to make this work for enums so that I won't have to use rawValues an manual parsing?</p>
  <pre class="lang-swift prettyprint-override"><code>@propertyWrapper
  struct Storage&lt;T&gt; {
    let objectName: String
    let defaultValue: T
    let defaults: UserDefaults
  
    init(_ objectName: String, defaultValue: T, defaults: UserDefaults = .standard) {
      self.objectName = objectName
      self.defaultValue = defaultValue
      self.defaults = defaults
    }
  
    var wrappedValue: T {
      get { return self.defaults.object(forKey: self.objectName) as? T ?? self.defaultValue }
      set { self.defaults.set(newValue, forKey: self.objectName) }
    }
  }
  </code></pre>
  <p>Currently my workaround is to wrap the object in another getter and setter for the enum like this.</p>
  <pre class="lang-swift prettyprint-override"><code>enum SomeType: String {
    case foo, bar, baz
  }
  
  
  class Defaults {
     @Storage(&quot;object&quot;, default: &quot;&quot;)
     private var: objectContainer: String
  
     var object: SomeType? {
        get {
           return SomeType(rawValue: self.objectContainer)
        }
        set {
           self.objectContainer = newValue.rawValue ?? &quot;&quot;
        }
     }
  }
  </code></pre>
  <p>I tried to create a different property wrapper specific for <code>RawRepresentable</code> types but Swift can't infer the type of <code>T</code> from that.</p>
  <pre class="lang-swift prettyprint-override"><code>@propertyWrapper
  struct RawRepresentableStorage&lt;T: RawRepresentable&gt; {
    let objectName: String
    let defaultValue: T
    let defaults: UserDefaults
    
    init(_ objectName: String, defaultValue: T, defaults: UserDefaults = .standard) {
      self.objectName = objectName
      self.defaultValue = defaultValue
      self.defaults = defaults
    }
    
    var wrappedValue: T {
      get {
        guard let object = self.defaults.object(forKey: self.objectName) as? T else {
          return self.defaultValue
        }
        
        // Error on this line:
        // `Cannot convert value of type 'T' to expected argument type 'T.RawValue'`
        return T(rawValue: object) ?? self.defaultValue 
      }
      set {
        self.defaults.set(newValue.rawValue, forKey: self.objectName)
      }
    }
  }
  </code></pre>
  <p>It also wouldn't be ideal to create Wrapper types for each storable enum within the codebase even if there are just a handful of them</p>
  <p>Is there something I'm missing or is this a current limitation of Swift?</p>