我有三节课:
class User : NSObject, Codable{
var id: Int! = 0
var userName: String!
enum CodingKeys:String,CodingKey{
case id
case userName = "user_name"
}
}
class SpecialUser : User{
var isAdmin: Bool!
}
class BlockedUser : User{
var isBlocked: Bool!
}
当我尝试对特殊用户或BlockedUser进行解码时,它们的额外属性始终为null 如何正确解码SpecialUser和BlockedUser?