Make class conforming to Codable by default in Swift
问题 Such feature of Swift as Codable ( Decodable & Encodable ) protocol is very useful. But I found such issue: Let we have class Parent conforming to Codable : class Parent: Codable { var name: String var email: String? var password: String? } Ok, that class is conforming to Codable protocol "from the box", you don't need write any initializers, it's ready to be initialized from JSON like that: { "name": "John", "email": "johndoe@yahoo.com", "password": <null>} But let's say we need other class,