title: "Combine latest" with ReactiveCocoa and signal of signals
body: <p>What's the best approach for implementing "combine latest" for signal of signals in ReactiveCocoa? I have the following problem:</p>
  
  <p>Given N text fields, subscribe to the <code>UIControlEditingEventChanged</code> event, and create a new signal based on the values that get called. The subscription is done once per subscriber and the values are then used in conjunction with one another. So here's what I've got:</p>
  
  <pre><code>__block NSMutableSet *subscriptions = [NSMutableSet set];
  RACSignal *validationSignals = [[[[TEXT_FIELDS rac_sequence].signal flattenMap:^RACStream* (UITextField *textField) {
      return [textField rac_signalForControlEvents:UIControlEventEditingChanged];
  }] flattenMap:^RACStream *(UITextField* textField) {
      if(![subscriptions containsObject:textField]) {
           [subscriptions addObject:textField];
          return [textField rac_validationSignal];
      }
      return [RACSignal empty];
  }]];
  </code></pre>
  
  <p>Where <code>rac_validationSignal</code> is my own class handling validation of UITextFields. The signals get through correctly, but only one at a time. I'd need the value of all subscriptions at once, in order to get the validity of all fields that are edited.</p>
  
  <p>EDIT:</p>
  
  <p>One possible solution involves a mutable array that I add the new field to and send the combination signal as I would normally. This seems quite good, any other ideas?</p>
  
  <pre><code>__block NSMutableSet *subscriptions = [NSMutableSet set];
  __block NSMutableArray *signals = [NSMutableArray array];
  RAC(self.editButton, enabled) =
  [[[[TEXT_FIELDS rac_sequence].signal flattenMap:^RACStream* (UITextField *textField) {
      return [textField rac_signalForControlEvents:UIControlEventEditingChanged];
  }] flattenMap:^RACStream *(UITextField* textField) {
      if(![subscriptions containsObject:textField]) {
          [subscriptions addObject:textField];
          [signals addObject:[textField rac_validationSignal]];
          return [RACSignal combineLatest:signals];
      }
      return [RACSignal empty];
  }] map:^NSNumber *(RACTuple *value) {
      for(NSNumber *isValid in value) {
          if(![isValid boolValue]) { return @(NO); }
      }
  return @(YES);
  }];
  </code></pre>
  
  <p>Thanks!</p>