de en es fr nl pl pt sv zh

enum

Handling unknown enum cases

5sw.de

Even though they are sometimes overused, enums are still a great tool. Thanks to Codable they can easily be decoded from JSON sent by your backend. This is great until you need to add a new case to the enum. Then you have to either deal with versioning your API or you need to tell your users...

Enum or struct?

5sw.de

I often see a pattern where there is an enum with a bunch of computed properties that return a different value for each case. In the rest of the code base then only those properties are used. Something like this: enum Style { case headline case bodyText case emphasis var...