Can reference types be Hashable?

Episode Clip • Oct 22, 2024

Reference types are very different from value types in Swift. They are an amalgamation of data and behavior that can be mutated at any time and from any place in your code base. It can be very tricky to conform such types to the Equatable and Hashable protocols, and in this clip we show one such example.

This clip comes from our exploration of the Equatable and Hashable protocols, where we discover the mathematical laws behind these protocols, and the right way to conform to them.

Watch full episode

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 71 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing