1
if let equatableObj = newFirstItem as? Equatable {
    // do something
}

error message: Error:(140, 64) protocol 'Equatable' can only be used as a generic constraint because it has Self or associated type requirements

How do i solve it?

Komal12
  • 3,340
  • 4
  • 16
  • 25
yang
  • 21
  • 1
  • 1
    [similar question here](https://stackoverflow.com/a/24962353/5685969) This is just a swift constraint. – 思齐省身躬行 Aug 18 '17 at 03:47
  • Be sure to use search: https://stackoverflow.com/search?q=Swift+equatable A lot of similar questions answered. – Hexfire Aug 18 '17 at 04:11
  • Does this answer your question? [Protocol can only be used as a generic constraint because it has Self or associatedType requirements](https://stackoverflow.com/questions/36348061/protocol-can-only-be-used-as-a-generic-constraint-because-it-has-self-or-associa) – Soumya Mahunt Sep 08 '22 at 06:28

1 Answers1

0

I just found a very detailed post about this topic at Swift by Sundell

wzso
  • 3,482
  • 5
  • 27
  • 48