🎉 End-of-year Sale! Save 25% when you subscribe today.
Although structs and enums have first class treatment in Swift and are awesome to use, structs tend to have nicer ergonomics than enums. We will explore what it would look like for enums to get many of the affordances that structs have.
These supplemental episodes use SwiftSyntax to build a code generation tool for enum properties, eliminating the burden of having to hand-roll them.
In this episode we compare structs and enums in a more abstract way: using algebra!
We’ve now seen how we can take a feature of structs, properties in particular, explore the equivalent API on enums, and find benefits, like more ergonomic data access. It’s time to take things to the next level by taking another, related feature of structs, key paths, and make a case for the enum equivalent.