---
title: "init(objects:count:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsorderedset/init(objects:count:)-2ai32"
---

# init(objects:count:)

Initializes a newly allocated set with a specified number of objects from a given C array of objects.

## Declaration

```swift
init(objects: UnsafePointer<AnyObject>?, count cnt: Int)
```

## Parameters

- `objects`: A C array of objects to add to the new set. If the same object appears more than once in objects, it is added only once to the returned ordered set.
- `cnt`: The number of objects from objects to add to the new ordered set.

## Return Value

Return Value An initialized ordered set containing cnt objects from the list of objects specified by objects. The returned set might be different than the original receiver.

## Discussion

Discussion This method is a designated initializer of NSOrderedSet.

## See Also

### Related Documentation

- [init(objects:count:)](foundation/nsorderedset/init(objects:count:)-3ny0m.md)

### Initializing an Ordered Set

- [init(array:)](foundation/nsorderedset/init(array:).md)
- [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(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)
