To create an enum in Swift, you can use the enum keyword followed by the name of the enumeration. Here's an example:
main.swift133 chars10 linesIn this example, we've defined an enumeration called Day, which has seven cases representing each day of the week.
You can also assign raw values to enum cases if desired:
main.swift75 chars6 linesIn this example, we've defined an enumeration called Numbers, which has three cases representing the numbers 1, 2, and 3.
You can use enums in Swift to represent a fixed set of values, which can make your code easier to read and maintain.
gistlibby LogSnag