【发布时间】:2020-08-16 13:01:53
【问题描述】:
我正在尝试实现这样的字符串数组枚举
import UIKit
enum EstimateItemStatus: Int, [String] {
case Pending
case OnHold
case Done
var description: [String] {
switch self {
case .Pending:
return ["one", "Two"]
case .OnHold:
return ["one", "Two"]
case .Done:
return ["one", "Two"]
}
}
}
print(EstimateItemStatus.Pending.description)
但是我收到了这个错误:
error: processArray.playground:3:31: error: multiple enum raw types 'Int' and '[String]'
enum EstimateItemStatus: Int, [String] {
~~~ ^
你们中的任何人都知道如何修复此错误以使枚举工作?
非常感谢您的帮助。
【问题讨论】:
标签: ios enums swift5.2 xcode11.4