contains(_:)
Returns a Boolean value that indicates whether a given object is present in the array.
Declaration
func contains(_ anObject: Any) -> BoolParameters
- anObject:
An object to look for in the array.
Return Value
Discussion
Starting at index 0, each element of the array is checked for equality with anObject until a match is found or the end of the array is reached. Objects are considered equal if isEqual(_:) returns true.
To determine if the array contains a particular instance of an object, you can test for identity rather than equality by calling the indexOfObjectIdentical(to:) method and comparing the return value to NSNotFound.