ios - How to use completion block with delegate -


i have class that's set delegate class b. how works method class uses instance of class b call method. after b's method done executing, call delegate method implemented in a.

what want have class a's method include success completion block, when b's method done executing, know same method in class b's method executed. can done?

in class a, store block property. in class b's delegate method (implemented class a), can call block via property.

@property (nonatomic, copy) void (^completion)(bool);  - (void)classamethod:(void (^)(bool))completion {     self.completion = completion;     [classb method]; }  - (void)classbdelegatemethod:(bool)result {     if(self.completion) {           self.completion(result);     } } 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -