Swift Enums and Equatability: With and Without Associated Values

Gurjit Singh
3 min readJan 23, 2024
Photo by Stanley Dai on Unsplash

Swift enums provide a powerful way to model a set of related values. Enums can be equipped with associated values, allowing them to represent a variety of data structures.

In Swift, the Equatable protocol enables instances of a type to be compared for equality. Let's explore how enums behave with and without associated values when conforming to the…

--

--

Gurjit Singh

I’m Computer Science graduate and an iOS Engineer who writes about Swift and iOS development. Follow me on twitter @gurjitpt and for more articles www.gurjit.co