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.