I’ve read up on blocks as much as I can, however I can’t seem to wrap my head around this concept. I’ve used blocks regularly where they are utilized to call success and failure blocks in an object’s owner’s class.
So, say I have ClassA with a variable of ClassB. I call [ClassB method1]. What exactly must be put into method1 in order to add the ability to run a success block assuming all goes well within method1? How does it know to invoke the success block that is written into ClassA? Any examples would be great.
Here is a rough and quick example.
In ClassB.h define the function with a success / failure block:
In ClassB.m:
Finally, in ClassA: