Swift how to use enum to get string value
enums, ios, swift
Solution
Use the `rawValue` of the enum:
cell.textLabel.text = NewProgramDetails.ToMode.rawValue
Problem
I have enum: ``` enum NewProgramDetails: String { case Description = "Description", ToMode = "To Mode", From = "From", To = "To", Days = "Days" static let allValues = [Description, ToMode, From, To, Days] } ``` I want to use this enum to display in my cell depend on indexPath: ``` cell.textLabel.text = NewProgramDetails.ToMode ``` error: Cannot assign value of type 'ViewController.NewProgramDetails' to type 'String?' How can I use enum values to assign it to label text as a string?