Archiving refers to a form of serialization, and any object specifically written to hold data should support archiving. The technique of archiving model objects makes it easy to write complex objects to files and then read them from them.
As long as each property implemented in a class is scalar or is an instance of a class that follows the nscoding protocol, you can fully archive the entire object. Most foundation and cocoa touch classes comply with the Nscoding protocol, so archiving is not too difficult for most classes.
Follow the Nscoding protocol:
Nscoding has declared two methods,
-(void) Encodewithcoder: (Nscoder *) Acoder; and-(Nullable Instancetype) Initwithcoder: (Nscoder *) Adecoder;
The first one is to encode the object into the archive, and the second is to decode the archive to create an object.
IOS to archive Model objects