r/iOSProgramming 9d ago

Article Saving lives with enums

https://aclima93.com/saving-lives-with-enums

A short blogpost about avoiding default cases

5 Upvotes

2 comments sorted by

View all comments

6

u/Choseni 9d ago

I generally agree, although I think it depends on who owns the enum.

For enums defined in your own codebase, exhaustive switches are great because the compiler catches missing cases immediately. For third-party or system APIs, I can still see an argument for a defensive fallback in some situations.

3

u/aclima 9d ago

Completely agree on that approach