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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -