---
title: "removeValue(forKey:)"
framework: xpc
role: symbol
role_heading: Instance Method
path: "xpc/xpcdictionary/removevalue(forkey:)"
---

# removeValue(forKey:)

Removes the given key and its associated value from the dictionary.

## Declaration

```swift
@discardableResult func removeValue(forKey key: String) -> xpc_object_t?
```

## Parameters

- `key`: The key to remove along with its associated value.

## Return Value

Return Value The value that was removed, or nil if the key was not present in the dictionary.
