title: Handling action from UITableViewCell in MVVM
body: <p>So I have this <code>BaseCell</code> class which also has this <code>BaseCellViewModel</code>. Of course on top of this lives some <code>FancyViewController</code> with <code>FancyViewModel</code>. The case here is that <code>BaseCell</code> has <code>UIButton</code> on it which triggers this <code>IBAction</code> method - that's fine and that's cool as I can do whatever I want there, but... I have no idea how should I let know <code>FacyViewController</code> about the fact that some <strong>action</strong> happened on <code>BaseCell</code>.</p>
  
  <p>I can <code>RACObserve</code> a property in <code>FancViewModel</code> as it has <code>NSArray</code> of those cell view models, but how to monitor actual action and notify about exact action triggered on cell?</p>
  
  <p>First thing that came to my mind is the delegation or notifications, but since we have <strong>RAC</strong> in our project it would be totally stupid not to use it, right?</p>
  
  <hr>
  
  <h3>[Edit] What I did so far...</h3>
  
  <p>So, it turns out youc can use <code>RACCommand</code> to actually handle UI events on specific button. In that case I've added:  </p>
  
  <pre><code>@property (strong, nonatomic) RACCommand *showAction;
  </code></pre>
  
  <p>to my <code>BaseCellViewModel</code> with simple implementation like:</p>
  
  <pre><code>- (RACCommand *)showAction {
      return [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
          NSLog(@"TEST");
          return [[RACSignal empty] logAll];
      }];
  }
  </code></pre>
  
  <p>And following this pattern I had to do something in my <code>BaseCell</code> which turned out to be quite simple and I ended up with adding:</p>
  
  <pre><code>- (void)configureWithViewModel:(JDLBasePostCellViewModel *)viewModel {
      self.viewModel = viewModel;
      self.actionButton.rac_command = self.viewModel.showAction;
  }
  </code></pre>
  
  <p>And... <strong>It works!</strong> But...<br>
  I need to present <code>UIActionSheet</code> whenever this happens and this can be show only when I need the current <code>parentViewController</code> and since I don't have this kind of information passed anywhere I don't know what to do right now.<br>
  <code>FancyViewModel</code> holds a private <code>@property (nonatomic, strong) NSMutableArray &lt;BaseCellViewModel *&gt; *cellViewModels;</code>, but how can I register something on <code>FancyViewController</code> to actually <strong>listen</strong> for execution of <code>RACCommand</code> on <code>BaseCellViewModel</code>?</p>