---
title: "firstObjectCommon(with:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsarray/firstobjectcommon(with:)"
---

# firstObjectCommon(with:)

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

## Declaration

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

## Parameters

- `otherArray`: An array.

## Return Value

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

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

## See Also

### Related Documentation

- [contains(_:)](foundation/nsarray/contains(_:).md)

### Comparing Arrays

- [isEqual(to:)](foundation/nsarray/isequal(to:).md)
