Function

object_getIvar(_:_:)

Reads the value of an instance variable in an object.

Declaration

func object_getIvar(_ obj: Any?, _ ivar: Ivar) -> Any?

Parameters

object

The object containing the instance variable whose value you want to read.

ivar

The Ivar describing the instance variable whose value you want to read.

Return Value

The value of the instance variable specified by ivar, or nil if object is nil.

Discussion

object_getIvar(_:_:) is faster than object_getInstanceVariable if the Ivar for the instance variable is already known.

See Also

Working with Instances

func object_setIvar(Any?, Ivar, Any?)

Sets the value of an instance variable in an object.

func object_getClassName(Any?)

Returns the class name of a given object.

func object_getClass(Any?)

Returns the class of an object.

func object_setClass(Any?, AnyClass)

Sets the class of an object.