---
title: "init(object:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsset/init(object:)"
---

# init(object:)

Creates and returns a set that contains a single given object.

## Declaration

```swift
convenience init(object: Any)
```

## Parameters

- `object`: The object to add to the new set. object receives a doc://com.apple.documentation/documentation/ObjectiveC/NSObject-c.protocol/retain message after being added to the set.

## Return Value

Return Value A new set that contains a single member, object.

## See Also

### Creating a Set

- [init(objects:count:)](foundation/nsset/init(objects:count:)-65ni4.md)
- [adding(_:)](foundation/nsset/adding(_:).md)
- [addingObjects(from:)](foundation/nsset/addingobjects(from:)-2i31h.md)
- [addingObjects(from:)](foundation/nsset/addingobjects(from:)-544m9.md)
