Instance Method

firstObjectCommon(with:)

Returns the first object contained in the receiving array that’s equal to an object in another given array.

Declaration

func firstObjectCommon(with otherArray: [Any]) -> Any?

Parameters

otherArray

An array.

Return Value

Returns the first object contained in the receiving array that’s equal to an object in otherArray. If no such object is found, returns nil.

Discussion

This method uses isEqual(_:) to check for object equality.

See Also

Comparing Arrays

func isEqual(to: [Any]) -> Bool

Compares the receiving array to another array.