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

# sel_registerName(_:)

Registers a method with the Objective-C runtime system, maps the method name to a selector, and returns the selector value.

```
func sel_registerName(_ str: UnsafePointer<CChar>) -> Selector
```

## Parameters

`str`

A pointer to a C string. Pass the name of the method you wish to register.

## Return Value

A pointer of type [`SEL`](/documentation/ObjectiveC/SEL) specifying the selector for the named method.

## Discussion

You must register a method name with the Objective-C runtime system to obtain the method’s selector before you can add the method to a class definition. If the method name has already been registered, this function simply returns the selector.

---

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)