Advanced and Practical Enum usage in Swift

UIKit Identifiers

UIKit Identifiers

Enums can be used to map reuse identifiers or storyboard identifiers from stringly typed information to something the type checker can understand. Imagine a UITableView with different prototype cells:

enum CellType: String {
    case buttonValueCell = "ButtonValueCell"
    case unitEditCell = "UnitEditCell"
    case labelCell = "LabelCell"
    case resultLabelCell = "ResultLabelCell"
}