Swiftgen: Add file names generator (nibs, plists, etc)

Created on 24 Mar 2017  路  7Comments  路  Source: SwiftGen/SwiftGen

Hi,

@AliSoftware We've met at AppDevCon, I wanted to adapt #108 to the new structure and making it more generic. As discussed back then, I'm opening an issue to discuss this.
You told me you were working on writing some docs on how to contribute now the project has been split in subprojects.
The first step would be to work on the SwiftGenKit part, right ?

enhancement

All 7 comments

For generators, the steps are:

  • First implement the generator in SwiftGenKit
  • Then implement the tests in SwiftGenKit. The necessary assets (input) and contexts (output) will be stored in the templates repository. Once you reach this point you'll open a related PR in the templates repo.
  • Once your contexts are correctly generated and tested, write your new templates (stencil) in the templates repo.
  • Once your templates are ready, write tests for them (in the templates repo). This will require the same contexts (input), but now you'll add the expected output (swift) files.
  • Finally, if need be, we might add some stuff to ensure the compilation of the output files works.
  • Once all this is done and merged, we could add a new command for this to the main swiftgen CLI tool (this repo).

Quick question: could you describe what features you'd like to implement?

What's the overlap with the reuseIdentifier issues/PRs? (https://github.com/SwiftGen/SwiftGenKit/pull/16, https://github.com/SwiftGen/SwiftGenKit/pull/15, https://github.com/SwiftGen/SwiftGen/pull/134) Or is it more an overlap with the codegen feature (https://github.com/SwiftGen/SwiftGen/pull/188), that could be expanded from JSON to include plist's?

Thank you for the explanations.

We use it solely to list nibs for the moment. There's no actual parsing of the nibs.
So the feature would simply be a listing of any type of files.

I will look into the issues/PRs you mentioned and get back to you !

Any updates on the state of this?
I am in need of something similar but with JSON鈥檚, I mean, seems like the existing templates for JSON鈥檚 already give me a reference to the files, but then I would be parsing some pretty big files without the need for it

@Robuske to my knowledge, I don't think any contributor took the time to start this yet.

Would be a good starter PR imho though, as the parser to implement for this would be pretty straightforward (nothing to parse actually, just return the file names) so the contexts to generate as output of the parser would just be something like an array of strings and the rest will follow.

We could improve further afterwards to not just return the file names but also the file type (UTI and/or MIME type), modification date and other meta data, but even adding that to the generated context shouldn't be that complicated 馃槈

Would be interesting to do it, but I honestly don鈥檛 know how to even start. Is the process still the same outlined by @djbe in the first comment?

Oh it's a bit simpler now, there are only 2 repos: StencilSwiftKit and SwiftGen. For this feature, you'd only need to modify the SwiftGen repo.

The steps themselves remain the same though, they're all just on 1 repo, and can be done in 1 PR. But before you start on a PR, maybe write a general outline of what the new command would and wouldn't do, general structure etc... So we can minimise the number of direction changes in the PR itself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielsaidi picture danielsaidi  路  7Comments

SummerHF picture SummerHF  路  3Comments

embassem picture embassem  路  3Comments

djbe picture djbe  路  6Comments

filip-zielinski picture filip-zielinski  路  3Comments