---
title: "object(forKey:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmaptable/object(forkey:)"
---

# object(forKey:)

Returns a the value associated with a given key.

## Declaration

```swift
func object(forKey aKey: KeyType?) -> ObjectType?
```

## Parameters

- `aKey`: The key for which to return the corresponding value.

## Return Value

Return Value The value associated with aKey, or nil if no value is associated with aKey.

## See Also

### Accessing Content

- [keyEnumerator()](foundation/nsmaptable/keyenumerator().md)
- [objectEnumerator()](foundation/nsmaptable/objectenumerator().md)
- [count](foundation/nsmaptable/count.md)
