yang
yang

Reputation: 21

How to Check the 'Equatable' protocol is implemented?

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?

Upvotes: 1

Views: 121

Answers (1)

wzso
wzso

Reputation: 3885

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

Upvotes: 0

Related Questions