As mentioned in my previous post, the raw values used with enumerations in Swift can be either String, Character, Int, Float or Double values. In certain cases though we might want to use custom values of our own. In this post, I thought I’d investigate a bit of a workaround.
Swift Enumerations
Enumerations, or ‘enums’ for short, are a common feature in many programming languages providing a convenient way of grouping a set of related values together into a single code construct. As we’ll see though, enumerations in Swift are much more capable than enumerations you may be used to, supporting many of the features that you would normally expect from structs and classes.