Add "import" option, which can be used to add (multiple) import statements#175
Add "import" option, which can be used to add (multiple) import statements#175dostrander merged 15 commits intoSwiftGen:masterfrom djbe:feature/storyboards-import
Conversation
|
This looks good! Now that #179 has been merged and that SwiftGen's code is now using Xcode 8, this should now be testable at last! |
AliSoftware
left a comment
There was a problem hiding this comment.
Ok could you please:
- Add at least one Unit Tests for each command (you can duplicate an existing Unit Test, change the call to GenumKit so it pass some values in
extraImports, and add fixtures containing those extra import statements) - add an entry in the CHANGELOG to mention this new feature and credit yourself
Otherwise seems 👌 ! Thx 😉
|
Allright, I've added one test (on iOS) + modified the "all" tests as there's a new storyboard. Let me know if the test I've made is correct/how you wanted it, and I'll do the same change(s) for the macOS tests. |
CHANGELOG.md
Outdated
|
|
||
| * Add option to add import statements at the top of the generated swift file (for | ||
| storyboards) using the `import` flag. Multiple imports can be added by repeating | ||
| this flag. |
There was a problem hiding this comment.
Could you add two spaces after the full-stop at the end of this line, like in other entries?
(This allows the rendered markdown to go on the next line in the same paragraph)
|
This first test looks good to me 👌 maybe except that it would be nice to be consistent in the imports vs the VC used? Like use the example of an extraImport Other than that seems ok so you can continue add the other tests for the other templates and we'd be able to merge this 👍 |
|
Oh, that explains why they were appearing on 1 line, I had no idea. I'll modify the test and add the macOS ones. Sent from my iPhone
|
|
Bump (I have no idea if you get notified when I push changes) |
|
I do ^^ Will take a look later when I'm at my computer |
| extension UIViewController { | ||
| func performSegue<S: StoryboardSegueType>(segue: S, sender: AnyObject? = nil) where S.RawValue == String { | ||
| performSegue(withIdentifier: segue.rawValue, sender: sender) | ||
| } |
There was a problem hiding this comment.
#194 is probably going to land soon. You may want to reflect what is in there as well and merge as it comes to the performSegue:
https://github.com/AliSoftware/SwiftGen/pull/194/files#diff-5eb3bf790669fb7ada0dfec0ac55ca5cR39
|
Looks good. Bad news, now that the changes in #194 has correctly been merged in here, that's #197 ( @dostrander I'm personally OK to merge both #197 and this #175, can I let you merge both in the order you prefer and let you fix the likely conflicts between the two on that |
|
@AliSoftware Yeah sounds good i'll take care of it :) |
|
Thx 👌 |
|
👍 |
Useful if you have view controllers which are classes from libraries.
For example, if you have a library A that provides a view controller class B, and instantiate that class in your storyboard, then the swiftgen generated file will reference class B. Problem is that swift won't be able to find B, unless you add
import Aat the top of the file.The provided solution should allow adding multiple import statements, but I honestly haven't been able to test it because:
let executableName = parser.shift()!)