This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension Encodable { | |
| func encode(with encoder: JSONEncoder = JSONEncoder()) throws -> Data { | |
| return try encoder.encode(self) | |
| } | |
| } | |
| extension Decodable { | |
| static func decode(with decoder: JSONDecoder = JSONDecoder(), from data: Data) throws -> Self { | |
| return try decoder.decode(Self.self, from: data) | |
| } |