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

# contains(_:)

Returns a Boolean value that indicates whether a given object is present in the set.

## Declaration

```swift
func contains(_ anObject: Any) -> Bool
```

## Parameters

- `anObject`: An object to look for in the set.

## Return Value

Return Value true if anObject is present in the set, otherwise false.

## Discussion

Discussion Each element of the set is checked for equality with anObject until a match is found or the end of the set is reached.  Objects are considered equal if isEqual(_:) returns true.

## See Also

### Accessing Set Members

- [allObjects](foundation/nsset/allobjects.md)
- [anyObject()](foundation/nsset/anyobject().md)
- [filtered(using:)](foundation/nsset/filtered(using:).md)
- [member(_:)](foundation/nsset/member(_:).md)
- [objectEnumerator()](foundation/nsset/objectenumerator().md)
- [enumerateObjects(_:)](foundation/nsset/enumerateobjects(_:).md)
- [enumerateObjects(options:using:)](foundation/nsset/enumerateobjects(options:using:).md)
- [objects(passingTest:)](foundation/nsset/objects(passingtest:).md)
- [objects(options:passingTest:)](foundation/nsset/objects(options:passingtest:).md)
