Should I use performSelector: when can I also call the method normally?
I want to call a method on an object that I am going through [self delegate]
. I know what class it is, so I can import the class and call it ok, but I can also use performSelector:
that doesn't require importing my class. I don't need to pass a parameter to the method. And yes, I read this one . Which one is preferable in this case?
a source to share
The method call is directly readable. performSelector:
should be reserved when you need higher order messaging.
Strictly speaking, you don't need to import the class in order to send a message to it, since sending the message is dynamic and not static, although you will get compile-time warnings that the object may not respond to the selector.
a source to share