<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMapRemove(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@NSMapRemove"
  },
  "title" : "NSMapRemove(_:_:)"
}
-->

# NSMapRemove(_:_:)

Removes a key and corresponding value from the specified table.

```
func NSMapRemove(_ table: NSMapTable<AnyObject, AnyObject>, _ key: UnsafeRawPointer?)
```

## Discussion

If `key` matches a key already in `table`, this function releases the preexisting key and its corresponding value.

## See Also

[`NSMapInsertIfAbsent`](/documentation/Foundation/NSMapInsertIfAbsent(_:_:_:))

Inserts a key-value pair into the specified table.

[`NSMapInsert`](/documentation/Foundation/NSMapInsert(_:_:_:))

Inserts a key-value pair into the specified table.

[`NSMapInsertKnownAbsent`](/documentation/Foundation/NSMapInsertKnownAbsent(_:_:_:))

Inserts a key-value pair into the specified table if the pair had not been previously added.



---

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)