Play with Enum in Swift-3.0……

Why Enum is required in Swift ??

* Defines a common type for a group of related values
 * Use Enum for Hard-Coded Strings

Sample Use of Enum

Associated Values && Raw Values ??

  • Associated Value is used to bind custom value along withCase .There is variation of value each time .
  • Raw Values is declaring default values for each case
Implicitly Assigned Raw Values
Get case IDENTIFIER by rawValue

If you want to play with Extension: play here


If you are more hungry to learn : play protocol