<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/class_respondsToSelector(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:@F@class_respondsToSelector"
  },
  "title" : "class_respondsToSelector(_:_:)"
}
-->

# class_respondsToSelector(_:_:)

Returns a Boolean value that indicates whether instances of a class respond to a particular selector.

```
func class_respondsToSelector(_ cls: AnyClass?, _ sel: Selector) -> Bool
```

## Parameters

`cls`

The class you want to inspect.

`sel`

A selector.

## Return Value

[`YES`](/documentation/ObjectiveC/YES) if instances of the class respond to the selector, otherwise [`NO`](/documentation/ObjectiveC/NO).

## Discussion

You should usually use `NSObject`’s [`responds(to:)`](/documentation/ObjectiveC/NSObjectProtocol/responds(to:)) or [`instancesRespond(to:)`](/documentation/ObjectiveC/NSObject-swift.class/instancesRespond(to:)) methods instead of this function.

---

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)