Understanding Hashable, Equatable, and Set Membership

July 1, 2018 | Swift, Protocols, Collections, iOS, macOS, tvOS, watchOS

The `Hashable` protocol in the Swift Standard Library allows us to use our own custom types as a key in a dictionary or as a member of a set. Conforming to `Hashable` where appropriate can make our code safer and improve performance. However, it's important to understand how `Hashable` and `Equatable` work together . . .