What is The Use of ENUM in Swift?

ENUM in Swift:

Enumerations are also known as enums. It is a special data type that enables us to group related types together and use them in a type-safe manner. Enumerations in Swift are not tied to integer values as they are in other languages, such as C or Java.

In Swift, we are able to define an enumeration with a type (string, character, integer, or floating-point) and then define its actual value (known as the raw value). Enumerations also support features that are traditionally only supported by classes, such as computed properties and instance methods.


enum Planets {
case Mercury
case Venus
case Earth
case Mars
case Jupiter
case Saturn
case Uranus
case Neptune