Stores a new value in a __weak variable.


func objc_storeWeak(_ location: AutoreleasingUnsafeMutablePointer<AnyObject?>, _ obj: Any?) -> Any?



The address of the weak pointer.


The new object you want the weak pointer to now point to.

Return Value

The value stored in location (that is, obj).


This function is typically used anywhere a __weak variable is the target of an assignment.

See Also

Using Objective-C Language Features

func objc_enumerationMutation(Any)

Inserted by the compiler when a mutation is detected during a foreach iteration.

func imp_implementationWithBlock(Any)

Creates a pointer to a function that calls the specified block when the method is called.

func imp_getBlock(IMP)

Returns the block associated with an IMP that was created using imp_implementationWithBlock(_:).

func imp_removeBlock(IMP)

Disassociates a block from an IMP that was created using imp_implementationWithBlock(_:), and releases the copy of the block that was created.

func objc_loadWeak(AutoreleasingUnsafeMutablePointer<AnyObject?>)

Loads the object referenced by a weak pointer and returns it.