<!--
{
  "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_getMethodImplementation(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:@F@class_getMethodImplementation"
  },
  "title" : "class_getMethodImplementation(_:_:)"
}
-->

# class_getMethodImplementation(_:_:)

Returns the function pointer that would be called if a particular message were sent to an instance of a class.

```
func class_getMethodImplementation(_ cls: AnyClass?, _ name: Selector) -> IMP?
```

## Parameters

`cls`

The class you want to inspect.

`name`

A selector.

## Return Value

The function pointer that would be called if `[object name]` were called with an instance of the class, or `NULL` if `cls` is `Nil`.

## Discussion

[`class_getMethodImplementation(_:_:)`](/documentation/ObjectiveC/class_getMethodImplementation(_:_:)) may be faster than `method_getImplementation(class_getInstanceMethod(cls, name))`.

The function pointer returned may be a function internal to the runtime instead of an actual method implementation. For example, if instances of the class do not respond to the selector, the function pointer returned will be part of the runtime’s message forwarding machinery.

---

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)