---
title: "objc_storeWeak(_:_:)"
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_storeweak(_:_:)"
---

# objc_storeWeak(_:_:)

Stores a new value in a __weak variable.

## Declaration

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

## Parameters

- `location`: The address of the weak pointer.
- `obj`: The new object you want the weak pointer to now point to.

## Return Value

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

## Discussion

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

## 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_loadWeak(_:)](objectivec/objc_loadweak(_:).md)
