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' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -