Allow additional imports with natalie-imports.json#55
Allow additional imports with natalie-imports.json#55ldiqual wants to merge 1 commit intokrzyzanowskim:masterfrom
Conversation
|
To be automatically detected in our perfect world you can put the file near the storyboard with specific extension, as I do with my PR https://github.com/krzyzanowskim/Natalie/pull/48/files |
|
what is wrong with specyfying module in storyboard? this is the easiest way to handle it. Configuration file introduce complication how to deal with the file, where to store etc. I'd like to realy avoid that as long as possible. |
|
you can't specify module for objective-c framework, this is what I understand in the corresponding issue |
|
@phimage |
|
Yes option is far better than adding an extra argument behind the file path
I prefer configuration files by storyboard because
that's why I make "plist" into PR #48 then plist VS json, the two are easy to read, but in Xcode I prefer create and edit plist file |
|
As a side note, if a solution is found to the issue #64 I just opened where I ask for a feature to have Natalie parse an xcodeproj file to generate target specific files, Natalie could automatically find out which frameworks each target is linked with. |
|
hello, I want merge this change, can you please rebase to current codebase ? 👍 |
@krzyzanowskim
Here's a proposed fix for #37, as per phimage's suggestion.
This commit modifies
natalie.swiftso it can take a second argumentimports_file_json. This JSON file must contain an array of all the framework names to import and that natalie might not be able to autodetect (see original issue).For example, in
natalie-imports.json:and then:
which will add
import FlatUIKitright before custom module imports.A couple notes:
natalie-imports.jsonto be automatically detected inprojectdir, but since the documentation says that the path should beprojectdir/projectnamewe'd have to go one directory up and that seems a bit hacky.--additional-imports natalie-imports.jsonwould be best, but I didn't want to add too much code without your approval (since we'd need to hack aroundProcess.argv)Let me know what you think about this solution and how to possibly improve it.