title: Identifiable protocol in Swift: class vs struct
body: <p>I'm using Swift 5.3</p>
  <p>Trying to understand why when I declare this construction</p>
  <pre><code>final class MyActivity: Identifiable {
      public let iHaveNoId: String = &quot;&quot;
  }
  </code></pre>
  <p>it compiles without any errors (even if I don't have &quot;id&quot; field implemented), while for struct</p>
  <pre><code>struct MyActivity: Identifiable {
      public let iHaveNoId: String = &quot;&quot;
  }
  </code></pre>
  <p>I get an error (as expected) - <strong>Type 'MyActivity' does not conform to protocol 'Identifiable'</strong></p>
  <p>Moreover, if I copy Identifiable source code and rename it to my own name, e.g.</p>
  <pre><code>public protocol MyIdentifiable {
      associatedtype ID : Hashable
      var id: Self.ID { get }
  }
  </code></pre>
  <p>then both struct and class implementing MyIdentifiable protocol will fail with a proper error <strong>Type 'MyActivity' does not conform to protocol 'MytIdentifiable'</strong></p>
  <p>I'm puzzled.</p>