我想做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的,为什么这使得它不可解码呢?
发布于 2021-08-12 22:02:28
当我也采用RecordType的Codable时,这个问题就消失了。找到答案here
extension RecordType: DatabaseValueConvertible, Codable {}https://stackoverflow.com/questions/68764513
复制相似问题