title: Generic Swift Struct cannot implement Realm Object protocol and Codable
body: <p>I have some Realm Objects that implement Object and Codable protocols. I would like to store them in a struct container that looks like the following:</p>
  <pre><code>struct LocalResource&lt;T&gt; where T: Object &amp; Codable {
      init (resource: FileResource) {
          self.realmType = T.self
          self.resource = resource
      }
      
      var codable: [T].Type {
          get {
              [T].self
          }
      }
      var realmType: T.Type
      var resource: FileResource
  }
  </code></pre>
  <p>Where I have a generic struct that holds the Realm Model that implements Object and Codable as well as some meta data associated with it. However, when I try to use this struct, such as in the following use:</p>
  <pre><code>let localModels: Array&lt;LocalResource&lt;Object &amp; Codable&gt;&gt; = []
  </code></pre>
  <p>I get the error:</p>
  <p><strong>'LocalResource' requires that 'Object &amp; Codable' (aka 'RealmSwiftObject &amp; Decodable &amp; Encodable') inherit from 'RealmSwiftObject'</strong></p>
  <p>I'm confused because 'Object &amp; Codable' does inherit from RealmSwiftObject. What am I doing wrong?</p>