What is Codable in Swift
1 min readAug 28, 2020
Codable was introduced in Swift since 4.0, which is used for encoding and decoding objects into JSON. From its definition we can see it is just the combination of Decodable
and Encodable
:
public typealias Codable = Decodable & Encodable
Example of using Codable
:
Define a custom object with Codable
:
Reference:
Originally published at https://needone.app on August 28, 2020.