{"action":"created","issue":{"url":"https://api.github.com/repos/Swinject/Swinject/issues/177","repository_url":"https://api.github.com/repos/Swinject/Swinject","labels_url":"https://api.github.com/repos/Swinject/Swinject/issues/177/labels{/name}","comments_url":"https://api.github.com/repos/Swinject/Swinject/issues/177/comments","events_url":"https://api.github.com/repos/Swinject/Swinject/issues/177/events","html_url":"https://github.com/Swinject/Swinject/issues/177","id":183740727,"number":177,"title":"isCreatingStoryboardReference -> a question","user":{"login":"josephbeuysmum","id":14836799,"avatar_url":"https://avatars.githubusercontent.com/u/14836799?v=3","gravatar_id":"","url":"https://api.github.com/users/josephbeuysmum","html_url":"https://github.com/josephbeuysmum","followers_url":"https://api.github.com/users/josephbeuysmum/followers","following_url":"https://api.github.com/users/josephbeuysmum/following{/other_user}","gists_url":"https://api.github.com/users/josephbeuysmum/gists{/gist_id}","starred_url":"https://api.github.com/users/josephbeuysmum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephbeuysmum/subscriptions","organizations_url":"https://api.github.com/users/josephbeuysmum/orgs","repos_url":"https://api.github.com/users/josephbeuysmum/repos","events_url":"https://api.github.com/users/josephbeuysmum/events{/privacy}","received_events_url":"https://api.github.com/users/josephbeuysmum/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Swinject/Swinject/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-18T16:40:36Z","updated_at":"2016-10-19T05:42:33Z","closed_at":null,"body":"Today I have been investigating the source of the problem I asked about in the following Stack Overflow link.\r\n\r\nhttp://stackoverflow.com/questions/40050100/dependency-injection-inconsistency-in-differing-viewcontrollers-in-swinject-pos\r\n\r\nThe particular set-up I have here is a TabBarController, containing four UIPageViewControllers, each of which has it's own set of UIViewControllers. When these UI elements pass through SwinjectStoryboard.instantiateViewController this is the printed debug output in the order it happens:\r\n\r\n```\r\n[line 81] instantiateViewController id: TabBarController\r\n[line 86] instantiateViewController id: TabBarController \r\n[line 88] instantiateViewController id: TabBarController\r\n...\r\n[line 81] instantiateViewController id: UIPageViewController-gL2-Zr-HmB\r\n[line 81] instantiateViewController id: DashboardViewController\r\n[line 86] instantiateViewController id: DashboardViewController \r\n[line 86] instantiateViewController id: UIPageViewController-gL2-Zr-HmB, vc: <JBM.AnalysisPageViewController>\r\n[line 88] instantiateViewController id: UIPageViewController-gL2-Zr-HmB\r\n```\r\n\r\n_line 81 is the start of the **instantiateViewController** function, line 86 is just before **if !SwinjectStoryboard.isCreatingStoryboardReference**, and line 88 is inside **if !SwinjectStoryboard.isCreatingStoryboardReference**._\r\n\r\nSo you see that the UIPageViewController pauses halfway through its own instantiation to allow the its default page \"DashboardViewController\" (as set in Main.storyboard) to instantiate itself. And this means that **SwinjectStoryboard.isCreatingStoryboardReference** is true, and therefore that DashboardViewController is not injected, even though it has been correctly registered for injection thus:\r\n\r\n```\r\nextension SwinjectStoryboard\r\n{\r\n\tclass func setup ()\r\n\t{\r\n\tdefaultContainer.registerForStoryboard( DashboardViewController.self )\r\n\t{\r\n\t\tr, vc in... etc.\r\n\t}\r\n```\r\n\r\nWhat should be done about this, do we think? I myself am not familiar enough with the internals of Swinject to know what the correct way forward is.\r\n\r\n:/\r\n"},"comment":{"url":"https://api.github.com/repos/Swinject/Swinject/issues/comments/254715661","html_url":"https://github.com/Swinject/Swinject/issues/177#issuecomment-254715661","issue_url":"https://api.github.com/repos/Swinject/Swinject/issues/177","id":254715661,"user":{"login":"jakubvano","id":2094466,"avatar_url":"https://avatars.githubusercontent.com/u/2094466?v=3","gravatar_id":"","url":"https://api.github.com/users/jakubvano","html_url":"https://github.com/jakubvano","followers_url":"https://api.github.com/users/jakubvano/followers","following_url":"https://api.github.com/users/jakubvano/following{/other_user}","gists_url":"https://api.github.com/users/jakubvano/gists{/gist_id}","starred_url":"https://api.github.com/users/jakubvano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakubvano/subscriptions","organizations_url":"https://api.github.com/users/jakubvano/orgs","repos_url":"https://api.github.com/users/jakubvano/repos","events_url":"https://api.github.com/users/jakubvano/events{/privacy}","received_events_url":"https://api.github.com/users/jakubvano/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T05:42:33Z","updated_at":"2016-10-19T05:42:33Z","body":"One thing I'm not clear on:\r\n>So you see that the UIPageViewController pauses halfway through its own instantiation to allow the its default page \"DashboardViewController\" (as set in Main.storyboard) to instantiate itself.\r\n\r\nHow do you set the default page of `UIPageViewController` in storyboard? Or even better - would it be possible for you to publish your storyboard setup which causes the problem (e.g. example in github repo)? It would really help with fixing this."}}
{"actor":{"display_login":"jakubvano"}}