Cocoa Question: How to get SEL string representation?

Is it possible if a SEL to generate a string representation of the method to which it refers?

For context:

I have an instance of an object initialized this way:

 -(id) initWithTarget:(id)object action: (SEL)action; 

Inside the instance, I would like to repeat the string name of the method referenced by SEL . How to do it?

+4
source share
2 answers

NSStringFromSelector

Converting in the opposite direction is also possible.

NSSelectorFromString

+8
source
+1
source

Source: https://habr.com/ru/post/1309377/


All Articles