Archives and Serialization

在属性列表、JSON和其他平面二进制表示形式之间来回转换对象和值。

主题

第一步

  • Encoding and Decoding Custom Types Make your data types encodable and decodable for compatibility with external representations such as JSON.

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

  • 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.

JSON

属性列表

XML

Keyed Archivers