I inherited Codable class like below.
class Vehicle: Codable {
let id: Int
let name: String
init(id: Int, name: String) {
self.id = id
self.name = name
}
}
class Car: Vehicle {
let type: String
init(id: Int, name: String, type: String) {
self.type = type
super.init(id: id, name: name)
}
}
And it shows error
'required' initializer 'init(from:)' must be provided by subclass of 'Vehicle'
What is a proper way to inherit codable class?