Returns a Boolean value that indicates whether a given object is present in the set.
SDKs
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
func contains(_ anObject: Any) -> Bool
Parameters
anObject
An object to look for in the set.
Return Value
true
if an
is present in the set, otherwise false
.
Discussion
Each element of the set is checked for equality with an
until a match is found or the end of the set is reached. Objects are considered equal if is
returns true
.