Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. RACSubject *subject = [RACReplaySubject replaySubjectWithCapacity:1];
  2. [subject sendCompleted];
  3. [subject finally:^{
  4. NSLog(@"never called");
  5. }];
  6. [subject subscribeCompleted:^{
  7. NSLog(@"called");
  8. }];
  9.  
  10. void (^block)() = ^ {
  11. NSLog(@"like finally!");
  12. };
  13. [subject subscribeError:^(NSError *error) {
  14. block();
  15. } completed:^{
  16. block();
  17. }];
  18.  
  19. RACSubject *subject = [RACSubject subject];
  20. [subject finally:^{
  21. NSLog(@"never called");
  22. }];
  23. [subject subscribeCompleted:^{
  24. NSLog(@"called");
  25. }];
  26. [subject sendCompleted];
  27.  
  28. RACSubject *subject = [RACReplaySubject replaySubjectWithCapacity:1];
  29. [subject sendCompleted];
  30. [[subject finally:^{
  31. NSLog(@"called now!");
  32. }] subscribeCompleted:^{
  33. NSLog(@"called");
  34. }];
  35.  
  36. RACSubject *subject = [RACReplaySubject replaySubjectWithCapacity:1];
  37. [subject sendCompleted];
  38. RACSignal *signalWithFinally = [subject finally:^{
  39. NSLog(@"finally block");
  40. }];
  41. [signalWithFinally subscribeCompleted:^{
  42. NSLog(@"first subscriber completed");
  43. }];
  44. [signalWithFinally subscribeCompleted:^{
  45. NSLog(@"second subscriber completed");
  46. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement