1- Define Your own custom Block
typedef void(^myCustomCompletion)(BOOL);
2- Create custom method which takes your custom completion block as a parameter.
-(void) customMethodName:(myCustomCompletion) compblock{
//do stuff
// check if completion block exist; if we do not check it will throw an exception
if(complblock)
compblock(YES);
}
3- How to use block in your Method
[self customMethodName:^(BOOL finished) {
if(finished){
NSLog(@"success");
}
}];