NSCoder
NSCoder is an abstract class in the Foundation framework that defines the interfaces for encoding and decoding objects, enabling serialization for persistence, interprocess communication, or network transfer. It provides the low-level methods used by concrete archivers, and is central to the supported object graph preservation in Apple's platforms.
In practice, encoding and decoding are performed through a pair of schemes. Keyed archiving uses methods that
To make a new class archivable, it should adopt the NSCoding protocol and implement two methods: init(coder:)
Security considerations are addressed by NSSecureCoding, an extension of NSCoding that enables secure decoding. Classes that
Usage generally involves archiving objects to Data or files via NSKeyedArchiver and later unarchiving with NSKeyedUnarchiver.