Swift class inheritance initializer error
The Decodable protocol requires the implementation of the method init(from:)
. Cause of adding a new property the automatically created init(from:)
method of the parent class is not inherited. This happens cause the inherited method can not initialize the new property from the child class.
Therefore the solution is to add the required method. For example like this (untested code)
required init(from decoder: Decoder) throws {
accessToken = try decoder.singleValueContainer().decode(String.self)
try super.init(from: decoder)
}