0

I want to make record of 4 different types. I have the following code

import GRDB

enum RecordType: Int16 {
    case video, image, text, rep
}
extension RecordType: DatabaseValueConvertible {}

struct Record: Codable, FetchableRecord, PersistableRecord {
    var id: Int64?
    var type: RecordType
}

Right now it complains Type 'Record' does not conform to protocol 'Decodable'

Of course when I remove the type from the struct, that complaint goes away. Since type is technically Int16 why does this make it not Decodable?

BigBoy1337
  • 4,735
  • 16
  • 70
  • 138

1 Answers1

1

When I adopt Codable to the RecordType as well this goes away. Found the answer here

extension RecordType: DatabaseValueConvertible, Codable {}
BigBoy1337
  • 4,735
  • 16
  • 70
  • 138