---
title: "sel_registerName(_:)"
framework: objectivec
role: symbol
role_heading: Function
path: "objectivec/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.

## Declaration

```swift
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

Return Value A pointer of type SEL specifying the selector for the named method.

## Discussion

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.

## See Also

### Working with Selectors

- [sel_getName(_:)](objectivec/sel_getname(_:).md)
- [sel_getUid(_:)](objectivec/sel_getuid(_:).md)
- [sel_isEqual(_:_:)](objectivec/sel_isequal(_:_:).md)
