---
title: "add(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nscountedset/add(_:)"
---

# add(_:)

Adds a given object to the set.

## Declaration

```swift
func add(_ object: Any)
```

## Parameters

- `object`: The object to add to the set.

## Discussion

Discussion If object is already a member, add(_:) increments the count associated with the object. If object is not already a member, it is sent a retain message.

## See Also

### Adding and Removing Entries

- [remove(_:)](foundation/nscountedset/remove(_:).md)
