Returns the version number assigned to the class.
- iOS 2.0+
- macOS 10.0+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The version number assigned to the class.
If no version has been set, the default is
Version numbers are needed for decoding or unarchiving, so older versions of an object can be detected and decoded correctly.
Caution should be taken when obtaining the version from within an
NSCoding protocol or other methods. Use the class name explicitly when getting a class version number:
Don’t simply send
version to the return value of class—a subclass version number may be returned instead.
The version number applies to
NSUnarchiver, but not to
NSKeyed. A keyed archiver does not encode class version numbers.