这是我的流利模型
struct Ailment: PostgreSQLModel {
enum Frequency: String , Content {
case regular = "Regular"
case occasional = "Occasional"
case incidentFound = "Incident Found"
}
var id: Int?
var ailment: String
var frequency: Frequency
var dateIdentified: Date?
var underMedication: Bool
var breifDescription: String
}
我能够使用Int Enum
创建Fluent模型,但不适用于String Enum
,
我正在接受例外
Fatal error: Error raised at top level: ⚠️ DecodingError: Cannot initialize Frequency from invalid String value 1
预先感谢:)