O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required