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

# objc_getAssociatedObject(_:_:)

Returns the value associated with a given object for a given key.

## Declaration

```swift
func objc_getAssociatedObject(_ object: Any, _ key: UnsafeRawPointer) -> Any?
```

## Parameters

- `object`: The source object for the association.
- `key`: The key for the association.

## Return Value

Return Value The value associated with the key key for object.

## See Also

### Associative References

- [objc_setAssociatedObject(_:_:_:_:)](objectivec/objc_setassociatedobject(_:_:_:_:).md)
- [objc_removeAssociatedObjects(_:)](objectivec/objc_removeassociatedobjects(_:).md)
