<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/XPCDictionary/removeValue(forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "s:3XPC13XPCDictionaryV11removeValue6forKeySo13OS_xpc_object_pSgSS_tF"
  },
  "title" : "removeValue(forKey:)"
}
-->

# removeValue(forKey:)

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

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

## Parameters

`key`

The key to remove along with its associated value.

## Return Value

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)