Returns the version number of a class definition.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Objective-C Runtime
A pointer to an
Classdata structure. Pass the class definition for which you wish to obtain the version.
An integer indicating the version number of the class definition.
You can use the version number of the class definition to provide versioning of the interface that your class represents to other classes. This is especially useful for object serialization (that is, archiving of the object in a flattened form), where it is important to recognize changes to the layout of the instance variables in different class-definition versions.
Classes derived from the Foundation framework
NSObject class can obtain the class-definition version number using the
get class method, which is implemented using the