<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/doesContain(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Objective-C Runtime",
      "ObjectiveC"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(im)doesContain:"
  },
  "title" : "doesContain(_:)"
}
-->

# doesContain(_:)

Returns a Boolean value that indicates whether the receiver contains a given object.

```
func doesContain(_ object: Any) -> Bool
```

## Parameters

`object`

The object to search for in the receiver.

## Return Value

[`YES`](/documentation/ObjectiveC/YES) if the receiver contains `object`, otherwise [`NO`](/documentation/ObjectiveC/NO).

## Discussion

Currently, [`doesContain(_:)`](/documentation/ObjectiveC/NSObject-swift.class/doesContain(_:)) messages are never sent to any object from within Cocoa itself.

The default implementation for this method provided by `NSObject` returns [`YES`](/documentation/ObjectiveC/YES) if the receiver is actually an `NSArray` object and an <doc://com.apple.documentation/documentation/Foundation/NSArray/indexOfObjectIdentical(to:)> message sent to the same object would return something other than `NSNotFound`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)