Introduction
This issue is a follow up for the PR SwiftGen/SwiftGen#188
The objective is to have a way to describe a context using JSON file(s) that will be run against a (and if possible multiple) stencil file(s) to generate Swift code.
Motivation
Right now, SwiftGen does two things:
- parse some input files (xcassets, storyboards...) into a context
- run this context on some stencil files (provided or not)
I see a use for the second feature on its own.
SwiftGen must provide a way to take context data and stencil as input and run all of this together.
This would allow users to use SwiftGen for any kind of input file.
This would make SwiftGen a code generator for any non-swift files, as Sourcery is a code generator for existing Swift files.
Proposed solution
Take JSON files as input and templates and generate a Swift file (and maybe several if it is possible).
The idea is not to offer some 'default' stencil like for the and enforce a JSON file format because both will be tighly coupled to what the user wants to do.
The solution was almost done in SwiftGen/SwiftGen#188 but needed some refinements.
I have started to work on converting this PR to the new design:
But before doing any PRs, I want to discuss this with you guys @djbe and @AliSoftware 😃