---
title: "init(array:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsorderedset/init(array:)"
---

# init(array:)

Initializes a newly allocated set with the objects that are contained in a given array.

## Declaration

```swift
convenience init(array: [Any])
```

## Parameters

- `array`: An array of objects to add to the new set. If the same object appears more than once in array, it is represented only once in the returned ordered set.

## Return Value

Return Value An initialized ordered set with the contents of array. The returned ordered set might be different than the original receiver.

## See Also

### Initializing an Ordered Set

- [init(array:copyItems:)](foundation/nsorderedset/init(array:copyitems:).md)
- [init(array:range:copyItems:)](foundation/nsorderedset/init(array:range:copyitems:).md)
- [init(object:)](foundation/nsorderedset/init(object:).md)
- [init(objects:count:)](foundation/nsorderedset/init(objects:count:)-2ai32.md)
- [init(orderedSet:)](foundation/nsorderedset/init(orderedset:).md)
- [init(orderedSet:copyItems:)](foundation/nsorderedset/init(orderedset:copyitems:).md)
- [init(orderedSet:range:copyItems:)](foundation/nsorderedset/init(orderedset:range:copyitems:).md)
- [init(set:)](foundation/nsorderedset/init(set:).md)
- [init(set:copyItems:)](foundation/nsorderedset/init(set:copyitems:).md)
- [init()](foundation/nsorderedset/init().md)
