Function

object_setClass(_:_:)

Sets the class of an object.

Declaration

func object_setClass(_ obj: Any?, _ cls: AnyClass) -> AnyClass?

Parameters

object

The object to modify.

sel

A class object.

Return Value

The previous value of object‘s class, or Nil if object is nil.

See Also

Working with Instances

func object_getIvar(Any?, Ivar) -> Any?

Reads the value of an instance variable in an object.

func object_setIvar(Any?, Ivar, Any?)

Sets the value of an instance variable in an object.

func object_getClassName(Any?) -> UnsafePointer<Int8>

Returns the class name of a given object.

func object_getClass(Any?) -> AnyClass?

Returns the class of an object.

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