Ability to pass arguments#62
Conversation
|
Thanks @webslesar for the pull request👍 I'll check it after merging #46 to avoid conflict. |
|
Can you add unit tests? |
|
Yes |
|
@yoichitgy Any plans for this? |
|
+1 for this. Would love to have this ability. |
There was a problem hiding this comment.
Sorry for taking so long to review this.
In general it is heading in the right direction 👍 , we just need to remove the repeated code and clean up the API. If you need some help setting up code generation, feel free to ask 😉
And as @yoichitgy pointed out earlier, adding unit tests to such nontrivial functionality would be very useful.
| name: "Animals", bundle: nil, container: container) | ||
| let firstArg: Int = 5 | ||
| let secondArg: SomeValue = SomeValue() | ||
| let catController = sb.instantiateViewController(withIdentifier: "SomeIdentifier", arg1: firstArg, arg2: secondArg) as! AnimalViewController |
There was a problem hiding this comment.
It would be more consistent to have API similar to Swinject, i.e.
instantiateViewController(withIdentifier: "SomeIdentifier", arguments: firstArg, secondArg)
|
|
||
| extension SwinjectStoryboard { | ||
|
|
||
| #if os(iOS) || os(tvOS) |
There was a problem hiding this comment.
We probably want to extend this for OSX as well
| for child in viewController.childViewControllers { | ||
| injectDependency(to: child) | ||
| } | ||
| } |
There was a problem hiding this comment.
This is a lot of repeated code between methods with different arguments. Can we reuse this code somehow? Alternatively we can generate this similarly to how it is done in Swinject (see. Container.Arguments.erb)
| } | ||
|
|
||
| } | ||
| #endif |
There was a problem hiding this comment.
Again, this file should probably be generated (see. Resolver.erb)
| s.license = 'MIT' | ||
| s.author = 'Swinject Contributors' | ||
| s.source = { :git => "https://github.com/Swinject/SwinjectStoryboard.git", :tag => s.version.to_s } | ||
| s.source = { :git => "https://github.com/SeductiveMobile/SwinjectStoryboard.git", :tag => s.version.to_s } |
…toryboard # Conflicts: # Cartfile
|
Fixed the issue of arguments capturing while using 'storyboardInitCompletedArgs' family methods. |
# Conflicts: # Cartfile.resolved # SwinjectStoryboard.podspec
With this improvements we can add ability to pass 3 arguments