Custom completion block for Custom Methods

suggest change

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");
}
}];

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents