Function

class_getInstanceVariable(_:_:)

Returns the Ivar for a specified instance variable of a given class.

Declaration

func class_getInstanceVariable(_ cls: AnyClass?, _ name: UnsafePointer<Int8>) -> Ivar?

Parameters

cls

The class whose instance variable you wish to obtain.

name

The name of the instance variable definition to obtain.

Return Value

A pointer to an Ivar data structure containing information about the instance variable specified by name.

See Also

Working with Classes

func class_getSuperclass(AnyClass?) -> AnyClass?

Returns the superclass of a class.

func class_setSuperclass(AnyClass, AnyClass) -> AnyClass

Sets the superclass of a given class.

Deprecated
func class_isMetaClass(AnyClass?) -> Bool

Returns a Boolean value that indicates whether a class object is a metaclass.

func class_getInstanceSize(AnyClass?) -> Int

Returns the size of instances of a class.

func class_getClassVariable(AnyClass?, UnsafePointer<Int8>) -> Ivar?

Returns the Ivar for a specified class variable of a given class.

func class_getIvarLayout(AnyClass?) -> UnsafePointer<UInt8>?

Returns a description of the Ivar layout for a given class.

func class_setIvarLayout(AnyClass?, UnsafePointer<UInt8>?)

Sets the Ivar layout for a given class.

func class_getWeakIvarLayout(AnyClass?) -> UnsafePointer<UInt8>?

Returns a description of the layout of weak Ivars for a given class.

func class_setWeakIvarLayout(AnyClass?, UnsafePointer<UInt8>?)

Sets the layout for weak Ivars for a given class.

func class_getProperty(AnyClass?, UnsafePointer<Int8>) -> objc_property_t?

Returns a property with a given name of a given class.

func class_addMethod(AnyClass?, Selector, IMP, UnsafePointer<Int8>?) -> Bool

Adds a new method to a class with a given name and implementation.

func class_getInstanceMethod(AnyClass?, Selector) -> Method?

Returns a specified instance method for a given class.

func class_getClassMethod(AnyClass?, Selector) -> Method?

Returns a pointer to the data structure describing a given class method for a given class.

func class_replaceMethod(AnyClass?, Selector, IMP, UnsafePointer<Int8>?) -> IMP?

Replaces the implementation of a method for a given class.

func class_getMethodImplementation(AnyClass?, Selector) -> IMP?

Returns the function pointer that would be called if a particular message were sent to an instance of a class.

func class_getMethodImplementation_stret(AnyClass?, Selector) -> IMP?

Returns the function pointer that would be called if a particular message were sent to an instance of a class.

func class_respondsToSelector(AnyClass?, Selector) -> Bool

Returns a Boolean value that indicates whether instances of a class respond to a particular selector.

func class_conformsToProtocol(AnyClass?, Protocol?) -> Bool

Returns a Boolean value that indicates whether a class conforms to a given protocol.

func class_getVersion(AnyClass?) -> Int32

Returns the version number of a class definition.

func class_setVersion(AnyClass?, Int32)

Sets the version number of a class definition.