Type Alias


A type that can convert itself into and out of an external representation.


typealias Codable = Decodable & Encodable


Codable is a type alias for the Encodable and Decodable protocols. When you use Codable as a type or a generic constraint, it matches any type that conforms to both protocols.

See Also

First Steps

Encoding and Decoding Custom Types

Make your data types encodable and decodable for compatibility with external representations such as JSON.

protocol NSCoding

A protocol that enables an object to be encoded and decoded for archiving and distribution.

protocol NSSecureCoding

A protocol that enables encoding and decoding in a manner that is robust against object substitution attacks.