How to use enum in Swift

Gurjit Singh
2 min readMar 7, 2023
Photo by Christopher Gower on Unsplash

Enumerations defines a type for group of related values.

Enumerations (enum) enables you to write code in a type safe way. Enum is very useful while defining common type of values. You don’t have to provide value while defining enum.

Syntax

You can declare enumerations with enum keyword.

enum SomeEnumerations {

}

--

--

Gurjit Singh

I’m Computer Science graduate and an iOS Engineer who writes about Swift and iOS development. Follow me on twitter @gurjitpt and for more articles www.gurjit.co