Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why NSInvocation

Why use NSInvocation when you could just call the method? Need to ask this question because I can't understand the need to use this class. What is the advantage of using it over just calling the method like below.

 [myArray addObject:myString];

Additional info: What specific challenges does it resolve/address which can't be addressed by the other method calling options.

like image 854
naz Avatar asked Sep 22 '26 02:09

naz


1 Answers

One use: You could use it to implement a chain of undo actions - where each different action would be a different method call to undo. You would encapsulate each undo action as a method call wrapped in an NSInvocation object.

like image 179
Gruntcakes Avatar answered Sep 24 '26 23:09

Gruntcakes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!