A ‘Swift’ Study of Enums

Photo by Christiana Rivers on Unsplash
 case .begin


Switch Statements

Raw Values

Raw Values: Implicitly Assigned Values

Invalid without specified raw type
Default Values for Int

Initialization from Raw Value

👀 Note: Raw Value initializer is a failable initializer !
Note the nil example!!

Associated Enums

Note how the associated value can be used or even omitted in different ways in a switch case:


Implement ‘CaseIterable’ in the definition of the enum or even an extension of the enum

case .theEnd



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


iOS dev eager to learn + advocate for unrepresented folk in tech. Engaged & empowered in community as Leadership Fellow @ WomenWhoCode Mobile + WTM Ambassador.