Returns the metaclass definition of a specified class.


func objc_getMetaClass(_ name: UnsafePointer<Int8>) -> Any!



The name of the class to look up.

Return Value

The Class object for the metaclass of the named class, or nil if the class is not registered with the Objective-C runtime.


If the definition for the named class is not registered, this function calls the class handler callback and then checks a second time to see if the class is registered. However, every class definition must have a valid metaclass definition, and so the metaclass definition is always returned, whether it’s valid or not.

See Also

Obtaining Class Definitions

func objc_copyClassList(UnsafeMutablePointer<UInt32>?) -> AutoreleasingUnsafeMutablePointer<AnyClass>?

Creates and returns a list of pointers to all registered class definitions.

func objc_lookUpClass(UnsafePointer<Int8>) -> AnyClass?

Returns the class definition of a specified class.

func objc_getClass(UnsafePointer<Int8>) -> Any!

Returns the class definition of a specified class.

func objc_getRequiredClass(UnsafePointer<Int8>) -> AnyClass

Returns the class definition of a specified class.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software