Advertisement
hardW

Elegance of Reactive Cocoa

Feb 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import "QuestionTextCell.h"
  2. #import "RKKFormTextView.h"
  3.  
  4. @interface QuestionTextCell ()
  5.  
  6. @property (nonatomic, assign) IBOutlet RKKFormTextView *textView;
  7.  
  8. @end
  9.  
  10. @implementation QuestionTextCell
  11.  
  12. - (void)setPlaying:(BOOL)play {
  13.     self.textView.editable = (!play);
  14. }
  15.  
  16. - (void)awakeFromNib {
  17.     [super awakeFromNib];
  18.    
  19.     @weakify(self);
  20.     [RACAble(self.question) subscribeNext:^(QuizQuestion *question) {
  21.         @strongify(self);
  22.        
  23.         self.textView.text = question.text;
  24.        
  25.         [question rac_liftSelector:@selector(setText:) withObjects:self.textView.rac_textSignal, nil];
  26.     }];
  27. }
  28.  
  29. - (void)dealloc {
  30.     self.textView.delegate = nil;
  31. }
  32.  
  33. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement