{"action":"closed","issue":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2127","labels_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2127/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2127/comments","events_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2127/events","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/issues/2127","id":90758087,"number":2127,"title":"What's the most elegant way to merge a dynamic set of signals?","user":{"login":"dougmcbride","id":101730,"avatar_url":"https://avatars.githubusercontent.com/u/101730?v=3","gravatar_id":"","url":"https://api.github.com/users/dougmcbride","html_url":"https://github.com/dougmcbride","followers_url":"https://api.github.com/users/dougmcbride/followers","following_url":"https://api.github.com/users/dougmcbride/following{/other_user}","gists_url":"https://api.github.com/users/dougmcbride/gists{/gist_id}","starred_url":"https://api.github.com/users/dougmcbride/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougmcbride/subscriptions","organizations_url":"https://api.github.com/users/dougmcbride/orgs","repos_url":"https://api.github.com/users/dougmcbride/repos","events_url":"https://api.github.com/users/dougmcbride/events{/privacy}","received_events_url":"https://api.github.com/users/dougmcbride/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-24T18:51:47Z","updated_at":"2015-06-26T17:36:36Z","closed_at":"2015-06-26T17:36:36Z","body":"I'm finding myself using the following little class quite a bit to present a changing set of signals as one merged signal. Is there a more elegant way to accomplish the same thing?\r\n\r\n```\r\n@interface SignalSet : NSObject\r\n@property (nonatomic, readonly) RACSignal *mergedSignal;\r\n- (void)addSignal:(RACSignal *)signal;\r\n@end\r\n\r\n@implementation SignalSet\r\n\r\n- (instancetype)init {\r\n    self = [super init];\r\n\r\n    if (self) {\r\n        _signals = [NSSet new];\r\n\r\n        _mergedSignal = [[RACObserve(self, signals) map:^RACSignal *(NSSet *signals) {\r\n            return [RACSignal merge:signals];\r\n        }] switchToLatest];\r\n    }\r\n\r\n    return self;\r\n}\r\n\r\n- (void)addSignal:(RACSignal *)signal {\r\n    self.signals = [self.signals setByAddingObject:signal];\r\n\r\n    [signal finally:^{\r\n        // Remove the signal from the set to release it\r\n        self.signals = [[NSSet alloc] initWithArray:[[self.signals rac_sequence] ignore:signal].array];\r\n    }];\r\n}\r\n\r\n@end\r\n```\r\n"}}