<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMapTable/init(keyOptions:valueOptions:capacity:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMapTable(im)initWithKeyOptions:valueOptions:capacity:"
  },
  "title" : "init(keyOptions:valueOptions:capacity:)"
}
-->

# init(keyOptions:valueOptions:capacity:)

Returns a map table, initialized with the given options.

```
init(keyOptions: NSPointerFunctions.Options = [], valueOptions: NSPointerFunctions.Options = [], capacity initialCapacity: Int)
```

## Parameters

`keyOptions`

A bit field that specifies the options for the keys in the map table. For possible values, see [`NSMapTableOptions`](/documentation/Foundation/NSMapTableOptions).

`valueOptions`

A bit field that specifies the options for the values in the map table. For possible values, see [`NSMapTableOptions`](/documentation/Foundation/NSMapTableOptions).

`initialCapacity`

The initial capacity of the map table. This is just a hint; the map table may subsequently grow and shrink as required.

## Return Value

A map table initialized using the given options.

## Discussion

`values` must contain entries at all the indexes specified in `keys`.

## See Also

  [Collections Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Collections/Collections.html#//apple_ref/doc/uid/10000034i)



---

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)