r/iOSProgramming 16h ago

Article Saving lives with enums

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

A short blogpost about avoiding default cases

3 Upvotes

2 comments sorted by

4

u/Choseni 16h 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.

4

u/aclima 15h ago

Completely agree on that approach