{"action":"created","issue":{"url":"https://api.github.com/repos/ReSwift/ReSwift/issues/174","repository_url":"https://api.github.com/repos/ReSwift/ReSwift","labels_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/174/labels{/name}","comments_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/174/comments","events_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/174/events","html_url":"https://github.com/ReSwift/ReSwift/issues/174","id":192892351,"number":174,"title":"Protocols without `associatedtype` for store","user":{"login":"dodikk","id":396451,"avatar_url":"https://avatars.githubusercontent.com/u/396451?v=3","gravatar_id":"","url":"https://api.github.com/users/dodikk","html_url":"https://github.com/dodikk","followers_url":"https://api.github.com/users/dodikk/followers","following_url":"https://api.github.com/users/dodikk/following{/other_user}","gists_url":"https://api.github.com/users/dodikk/gists{/gist_id}","starred_url":"https://api.github.com/users/dodikk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dodikk/subscriptions","organizations_url":"https://api.github.com/users/dodikk/orgs","repos_url":"https://api.github.com/users/dodikk/repos","events_url":"https://api.github.com/users/dodikk/events{/privacy}","received_events_url":"https://api.github.com/users/dodikk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-01T16:20:17Z","updated_at":"2016-12-08T02:19:08Z","closed_at":"2016-12-08T02:19:08Z","body":"I'd like to inject the `StoreType` protocol as an ivar to my `ViewModel ==> Model ==> service` classes to let them dispatch the actions.\r\n\r\nI'm experiencing the compiler errors similar to those described in the gist below.\r\nhttps://gist.github.com/dodikk/d5d62002c6cf730c4b059215beeb9203\r\n\r\nHaving a protocol without the `associatedtype` would let me accomplish that just fine.\r\n"},"comment":{"url":"https://api.github.com/repos/ReSwift/ReSwift/issues/comments/265634488","html_url":"https://github.com/ReSwift/ReSwift/issues/174#issuecomment-265634488","issue_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/174","id":265634488,"user":{"login":"Qata","id":1232443,"avatar_url":"https://avatars.githubusercontent.com/u/1232443?v=3","gravatar_id":"","url":"https://api.github.com/users/Qata","html_url":"https://github.com/Qata","followers_url":"https://api.github.com/users/Qata/followers","following_url":"https://api.github.com/users/Qata/following{/other_user}","gists_url":"https://api.github.com/users/Qata/gists{/gist_id}","starred_url":"https://api.github.com/users/Qata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qata/subscriptions","organizations_url":"https://api.github.com/users/Qata/orgs","repos_url":"https://api.github.com/users/Qata/repos","events_url":"https://api.github.com/users/Qata/events{/privacy}","received_events_url":"https://api.github.com/users/Qata/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T02:19:08Z","updated_at":"2016-12-08T02:19:08Z","body":"If it's necessary that you have this ivar then you can use a generic type so that your ViewModel would look something like:\r\n\r\n```swift\r\nclass ViewModel<Store: StoreType> {\r\n    var store: Store\r\n    init(store: Store) {\r\n        self.store = store\r\n    }\r\n}\r\n```\r\n\r\nI'm not entirely sure why you're trying to use `StoreType`, your app shouldn't have multiple stores. If you're just trying to get a reference to the `Store` that your app is using then I'd recommend using a `typealias` instead. \r\n\r\nI'm going to close this since it's not an issue, we can't realistically remove the conformance without breaking functionality greatly, feel free to keep commenting if you run into issues with the workarounds though, it just won't be seen as a \"bug\" anymore."}}
{"actor":{"display_login":"Qata"}}