---
title: "init(set:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nscountedset/init(set:)"
---

# init(set:)

Returns a counted set object initialized with the contents of a given set.

## Declaration

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

## Parameters

- `set`: An set of objects to add to the new set.

## Return Value

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

## See Also

### Related Documentation

- [init(set:)](foundation/nsset/init(set:)-1xovx.md)

### Initializing a Counted Set

- [init(array:)](foundation/nscountedset/init(array:).md)
- [init(capacity:)](foundation/nscountedset/init(capacity:).md)
