<!--
{
  "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/NSHashTable/init(options:capacity:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSHashTable(im)initWithOptions:capacity:"
  },
  "title" : "init(options:capacity:)"
}
-->

# init(options:capacity:)

Returns a hash table initialized with the given attributes.

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

## Parameters

`options`

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

`initialCapacity`

The initial number of elements the hash table can hold.

## Return Value

A hash table initialized with options specified by `options` and initial capacity of `capacity`.

## 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)