Now that you have taught your Employee object to encode and decode itself, you are now ready to add saving and loading to your application. When it is time to save your employees to a file, your Document class will be asked to create an instance of NSData. Once your object has created and returned an NSData object, it will be automatically written to a file.
To create an NSData object, you will use the NSKeyedArchiver class. NSKeyedArchiver has the following class method:
class func archivedDataWithRootObject(rootObject: AnyObject) -> NSData
This method archives the objects into the NSData object’s buffer of bytes.
Once again, ...