Name

NSCoding — Mac OS X 10.0

Synopsis

This protocol declares an interface is adopted by classes to provide for archiving and unarchiving of instances of the class. The NSCoding protocol defines the two methods initWithCode: and encodeWithCode:. These two methods are the foundation of archiving and distribution in the Foundation framework. Each of these two methods passes an NSCoder object, which is used to perform archiving and unarchiving. The NSCoder class provides the tools to encode and decode objects and C and Objective-C data types. See the NSCoder class description and Chapter 2 for more information.

@protocol NSCoding
                                  // Instance Methods
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
@end

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.