我想记录4种不同的类型。我有以下代码
import GRDB
enum RecordType: Int16 {
case video, image, text, rep
}
extension RecordType: DatabaseValueConvertible {}
struct Record: Codable, FetchableRecord, PersistableRecord {
var id: Int64?
var type: RecordType
}
现在它抱怨Type 'Record' does not conform to protocol 'Decodable'
当然,当我从结构中删除类型时,这种抱怨就消失了。由于类型在技术上是 Int16,为什么这使它不可解码?