encodeRestorableState(with:)
Encodes state-related information for the object.
Declaration
optional func encodeRestorableState(with coder: NSCoder)Parameters
- coder:
The coder object to use to encode the state of the object.
Mentioned in
Discussion
You can implement this method for any object that has state information you want to preserve. When deciding what data to save, write the smallest amount of data needed to restore the object to its current configuration. The information you save should be data that you could not easily recreate. You can also save references to other objects, such as the view controller that was using the object.
It is strongly recommended that you call super at some point during your implementation to give parent classes an opportunity to save information too.