{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/3352","repository_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa","labels_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/3352/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/3352/comments","events_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/3352/events","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/issues/3352","id":196680111,"number":3352,"title":"How to better combine signal sequences ?","user":{"login":"pigfly","id":1074069,"avatar_url":"https://avatars.githubusercontent.com/u/1074069?v=3","gravatar_id":"","url":"https://api.github.com/users/pigfly","html_url":"https://github.com/pigfly","followers_url":"https://api.github.com/users/pigfly/followers","following_url":"https://api.github.com/users/pigfly/following{/other_user}","gists_url":"https://api.github.com/users/pigfly/gists{/gist_id}","starred_url":"https://api.github.com/users/pigfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pigfly/subscriptions","organizations_url":"https://api.github.com/users/pigfly/orgs","repos_url":"https://api.github.com/users/pigfly/repos","events_url":"https://api.github.com/users/pigfly/events{/privacy}","received_events_url":"https://api.github.com/users/pigfly/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-20T14:02:56Z","updated_at":"2016-12-21T03:08:25Z","closed_at":null,"body":"Hi all, \r\n\r\nI'm having a sequence of signals that need to get combined and mapped, the scenario looks like the following:\r\n\r\n```swift\r\n// all these four signals are of same type ` Signal<Bool, NoError>`\r\n Signal\r\n      .combineLatest(validNameSignal, validEmailSignal, validCitySignal, dateSignal)\r\n      // there is a better way...\r\n      .map { $0 && $1 && $2 && $3 }\r\n      .observeValues {[unowned self] isValid in\r\n        self.checkButton.isEnabled = isValid\r\n    }\r\n```\r\n\r\nIn my case, I'm wondering if there is a better way to map `(Bool, Bool, Bool, Bool)` into `Bool`,\r\ngiven this type of mapping is very common.\r\n\r\nI've noticed that in the earlier version of RAC, there is one `and` operation to achieve this. \r\n```swift\r\nRACSignal.combineLatest([nameSignal, emailSignal, citySignal]).and()\r\n```\r\nHowever I'm using 5.0.0-alpha.5, I guess things have changed in this case.\r\n\r\nAppreciate for any meaningful responses :)"},"comment":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/comments/268423181","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/issues/3352#issuecomment-268423181","issue_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/3352","id":268423181,"user":{"login":"andersio","id":11806295,"avatar_url":"https://avatars.githubusercontent.com/u/11806295?v=3","gravatar_id":"","url":"https://api.github.com/users/andersio","html_url":"https://github.com/andersio","followers_url":"https://api.github.com/users/andersio/followers","following_url":"https://api.github.com/users/andersio/following{/other_user}","gists_url":"https://api.github.com/users/andersio/gists{/gist_id}","starred_url":"https://api.github.com/users/andersio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersio/subscriptions","organizations_url":"https://api.github.com/users/andersio/orgs","repos_url":"https://api.github.com/users/andersio/repos","events_url":"https://api.github.com/users/andersio/events{/privacy}","received_events_url":"https://api.github.com/users/andersio/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T03:08:25Z","updated_at":"2016-12-21T03:08:25Z","body":"We think this is a sign of [fragile layering](https://github.com/ReactiveCocoa/ReactiveCocoa/issues/3353). The \"truth\" should have been maintained in the Controller layer (MVC) or the View Model layer (MVVM), and you'd run your business logic in those layers instead of in the views.\r\n\r\nBut everyone has a certain constraints. So if tweaking your codebase for proper layering is not an immediate goal, `SignalProducer.prefix` as suggested by @sharplet is the interim solution."}}
{"actor":{"display_login":"andersio"}}