Function

object_setIvar(_:_:_:)

Sets the value of an instance variable in an object.

Declaration

func object_setIvar(_ obj: Any?, _ ivar: Ivar, _ value: Any?)

Parameters

object

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

ivar

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

value

The new value for the instance variable.

Discussion

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

See Also

Working with Instances

func object_getIvar(Any?, Ivar)

Reads 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.