-
Notifications
You must be signed in to change notification settings - Fork 144
Injection on storyboard reference #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Injection on storyboard reference #15
Conversation
…ial segues This requires use of relationship storyboard segues which is only supported since iOS 9.0, thus target version of test bundle has to be increased.
Last 2 commits should also fix Swinject#125 |
Thank you for fixing the issue. It looks good to me. It is very difficult to subclass UIStoryboard for its irregular initializer and storyboard references. I think my implementation using static Only one problem I found was unit tests failed on iOS 8.1 devices both in Travis and my local environment (Xcode 7.3.1). Would you check the problem? |
Described issues manifest when you use storyboard reference for relationship segues (e.g. root view controller is in referenced storyboard) - this feature is only supported in iOS Not sure how to solve this - one option would be to isolate problematic tests to different test bundle which would be only ran on iOS |
I think we can use if #available(iOS 9.0, *) {
// The test code here.
} It's good to document that the storyboard reference feature works properly only on iOS 9.0+. We can keep supporting and testing iOS 8 except the storyboard reference feature working. |
Thanks @jakubvano very much for fixing the issue, and adding a comment about the use of We might be able to reduce hacky code when we got a nice idea in the future. I introduced the static |
@jakubvano, I usually add merged pull requests to a milestone not to forget mentioning them in its release note. This time, I added this pull request to milestone |
👍 hopefully I will learn this flow soon enough 😄 |
This is just my way, but I put merged pull requests into a milestone representing the next version. When I release the version, I write a release note listing the changes with contributor names. For example:
Some people prefer writing CHANGELOG when they merge pull requests, but I prefer writing things later. I also do not make CHANGELOG file in Swinject repos because release notes show the changes. I will write document for release procedure soon (or later😅) |
As reported in Swinject#128, injection on storyboard references does not work properly when initial storyboard is created with custom (other than
defaultContainer
) container. @VladimirBorodko pointed out in this comment that problem is caused by not passing custom container when creating an instance of referenced storyboard.This fixes the issue, however it introduces stack of storyboards used during instantiation of view controller, which is needed to obtain container of "parent" storyboard when creating storyboard reference. It is a bit too hacky for my taste, and would love if someone could come up with better solution.