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

# init(set:)

Initializes a new ordered set with the contents of a set.

```
convenience init(set: Set<AnyHashable>)
```

## Parameters

`set`

The set.

## Return Value

An initialized ordered set containing the objects in the set.

## See Also

[`+  orderedSetWithSet:`](/documentation/Foundation/NSOrderedSet/orderedSetWithSet:)

Creates and returns an ordered set with the contents of a set.

[`+  orderedSetWithSet:copyItems:`](/documentation/Foundation/NSOrderedSet/orderedSetWithSet:copyItems:)

Creates and returns an ordered set with the contents of a set, optionally copying the items.



---

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)