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

# count(for:)

Returns the count associated with a given object in the set.

## Declaration

```swift
func count(for object: Any) -> Int
```

## Parameters

- `object`: The object for which to return the count.

## Return Value

Return Value The count associated with object in the set, which can be thought of as the number of occurrences of object present in the set.

## See Also

### Related Documentation

- [count](foundation/nsset/count.md)

### Examining a Counted Set

- [objectEnumerator()](foundation/nscountedset/objectenumerator().md)
