people I am working with don't wanna use delegate methods for a couple of reasons and they want me to come up with a solution;
basically they want a callback block with multiple return values, and when the first return value arrived block should still wait for the upcoming return values
something like
[parserobject parsefile:file withCallback {
if (started) {
//file parsing started
//this should get executed first
}
//if file parsing succesfully started also check if it
//succesfully finished or failed in the same callback
if (finished) {
//file parsing finished
}
if(failed)
{
//this represents if parsing failed any time from start to finish
//if so exit the callback
}
}];
I have seen people using structs
or nsintegers
to return different values but usually only one result is returned....
is that above code block possible to written in objective-c?
This is your function
Then you call it like this
A simple example
This is the function part
This will output