Encodes state-related information for the object.
- iOS 7.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
The coder object to use to encode the state of the object.
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.