---
title: "objc_loadWeak(_:)"
framework: Objective-C Runtime
role: symbol
role_heading: Function
platforms: [iOS 5.0+, iPadOS 5.0+, Mac Catalyst 13.1+, macOS 10.7+, tvOS 9.0+, visionOS 1.0+, watchOS 1.0+]
path: "objectivec/objc_loadweak(_:)"
---

# objc_loadWeak(_:)

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

## Declaration

```swift
func objc_loadWeak(_ location: AutoreleasingUnsafeMutablePointer<AnyObject?>) -> Any?
```

## Parameters

- `location`: The address of the weak pointer.

## Return Value

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

## Discussion

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(_:)](objectivec/objc_enumerationmutation(_:).md)
- [objc_setEnumerationMutationHandler(_:)](objectivec/objc_setenumerationmutationhandler(_:).md)
- [imp_implementationWithBlock(_:)](objectivec/imp_implementationwithblock(_:).md)
- [imp_getBlock(_:)](objectivec/imp_getblock(_:).md)
- [imp_removeBlock(_:)](objectivec/imp_removeblock(_:).md)
- [objc_storeWeak(_:_:)](objectivec/objc_storeweak(_:_:).md)
