---
title: "init(keyOptions:valueOptions:capacity:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsmaptable/init(keyoptions:valueoptions:capacity:)"
---

# init(keyOptions:valueOptions:capacity:)

Returns a map table, initialized with the given options.

## Declaration

```swift
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 doc://com.apple.foundation/documentation/Foundation/NSMapTableOptions.
- `valueOptions`: A bit field that specifies the options for the values in the map table. For possible values, see doc://com.apple.foundation/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

Return Value A map table initialized using the given options.

## Discussion

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

## See Also

### Related Documentation

- [Collections Programming Topics](apple-archive/documentation/Cocoa/Conceptual/Collections.md)

### Creating and Initializing a Map Table

- [init(keyOptions:valueOptions:)](foundation/nsmaptable/init(keyoptions:valueoptions:).md)
- [init(keyPointerFunctions:valuePointerFunctions:capacity:)](foundation/nsmaptable/init(keypointerfunctions:valuepointerfunctions:capacity:).md)
- [strongToStrongObjects()](foundation/nsmaptable/strongtostrongobjects().md)
- [weakToStrongObjects()](foundation/nsmaptable/weaktostrongobjects().md)
- [strongToWeakObjects()](foundation/nsmaptable/strongtoweakobjects().md)
- [weakToWeakObjects()](foundation/nsmaptable/weaktoweakobjects().md)
- [NSMapTableOptions](foundation/nsmaptableoptions.md)
