archiver(_:willEncode:)
Informs the delegate that object is about to be encoded.
Declaration
optional func archiver(_ archiver: NSKeyedArchiver, willEncode object: Any) -> Any?Parameters
- archiver:
The archiver that sent the message.
- object:
The object that is about to be encoded. This value is never
nil.
Return Value
Either object or a different object to be encoded in its stead. The delegate can also modify the coder state. If the delegate returns nil, nil is encoded.
Discussion
This method is called after the original object may have replaced itself with replacementObject(for:):.
This method is called whether or not the object is being encoded conditionally.
This method is not called for an object once a replacement mapping has been set up for that object (either explicitly, or because the object has previously been encoded). This method is also not called when nil is about to be encoded.