<!--
{
  "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/NSCreateMapTableWithZone(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@NSCreateMapTableWithZone"
  },
  "title" : "NSCreateMapTableWithZone(_:_:_:_:)"
}
-->

# NSCreateMapTableWithZone(_:_:_:_:)

Creates a new map table in the specified zone.

```
func NSCreateMapTableWithZone(_ keyCallBacks: NSMapTableKeyCallBacks, _ valueCallBacks: NSMapTableValueCallBacks, _ capacity: Int, _ zone: NSZone?) -> NSMapTable<AnyObject, AnyObject>
```

## Return Value

A new map table in allocated in `zone`. If `zone` is `NULL`, the hash table is created in the default zone.

## Discussion

The table’s size is dependent on (but generally not equal to) `capacity`. If `capacity` is 0, a small map table is created. The [`NSMapTableKeyCallBacks`](/documentation/Foundation/NSMapTableKeyCallBacks) arguments are structures that are very similar to the callback structure used by [`NSCreateHashTable(_:_:)`](/documentation/Foundation/NSCreateHashTable(_:_:)); in fact, they have the same defaults as documented for that function.

## See Also

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

Performs a shallow copy of the specified map table.

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

Creates a new map table in the default zone.



---

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)