我有枚举:
enum NewProgramDetails: String { case Description = "Description",ToMode = "To Mode",From = "From",To = "To",Days = "Days" static let allValues = [Description,ToMode,From,To,Days] }
我想使用这个枚举在我的单元格中依赖于indexPath显示:
cell.textLabel.text = NewProgramDetails.ToMode
错误:无法指定类型’ViewController.NewProgramDetails’的值来键入’String?’
解决方法
使用枚举的rawValue:
cell.textLabel.text = NewProgramDetails.ToMode.rawValue