version()
Returns the version number assigned to the class.
Declaration
class func version() -> IntReturn Value
The version number assigned to the class.
Discussion
If no version has been set, the default is 0.
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:
version = [MyClass version];Don’t simply send version to the return value of class—a subclass version number may be returned instead.
Special Considerations
The version number applies to NSArchiver/NSUnarchiver, but not to NSKeyedArchiver/NSKeyedUnarchiver. A keyed archiver does not encode class version numbers.