Stephen Haney

Using the Power of Swift Enums

Quickly: General Enum Usage

You can use enums to create a new type in your code for use with related values. It can be a shortcut for a Class when you know the number of instances you’ll need ahead of time (you can create an enum called ‘Month’ with members like January, February, March, and so on). Typically you’d use an enum when all values can be hard coded, but Swift opens the door for some other uses. Let’s explore the new abilities.