Function

objc_loadWeak

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

Declaration

id objc_loadWeak(id  _Nullable *location);

Parameters

location

The address of the weak pointer.

Return Value

The object pointed to by location, or nil if location is nil.

Discussion

This function loads the object referenced by a weak pointer and returns it after retaining and autoreleasing the object. As a result, the object stays alive long enough for the caller to use it. This function is typically used anywhere a __weak variable is used in an expression.

See Also

Using Objective-C Language Features

objc_enumerationMutation

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

objc_setEnumerationMutationHandler

Sets the current mutation handler.

imp_implementationWithBlock

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

imp_getBlock

Returns the block associated with an IMP that was created using imp_implementationWithBlock.

imp_removeBlock

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

objc_storeWeak

Stores a new value in a __weak variable.