I have just discovered completion blocks:
completion:^(BOOL finished){
}];
What do I need to do to have my own method take a completion block?
1) Define your own completion block,
typedef void(^myCompletion)(BOOL);
2) Create a method which takes your completion block as a parameter,
-(void) myMethod:(myCompletion) compblock{
//do stuff
compblock(YES);
}
3)This is how you use it,
[self myMethod:^(BOOL finished) {
if(finished){
NSLog(@"success");
}
}];