Enum are new types introduced in Swift to group set of constant values under a single name.
It helps developers to have type safety.
Let’s see how to create an enum.
Enum is created with enum keyword in swift
enum ENUMTYPE{
case VALUE,
case VALUE
}
Here is an example
enum Weekend{
case SATURDAY
case SUNDAY
}
Weekend is a new user custom type in which we can create a variable. It contains SATURDAY and SUNDAY values.
Enum types name always capitalized similar to classes in Swift