Skip to content

Commit 697e4a9

Browse files
committed
Some small tweaks as mentioned in feedback
1 parent dcde579 commit 697e4a9

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

Documentation/Articles/SwiftLint-Integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ Feel free to use this and adapt to your needs, especially:
4545

4646
## Contribution
4747

48-
This example configuration is only an example/suggestion. It might not be perfect, we haven't tested _all_ the use cases, so maybe the regular expressions will have to be tuned/improved if you find a false positive or a use case that those didn't catch. If that's the case, don't hesitate to contribute by at least commenting on https://github.com/SwiftGen/SwiftGen/issues/446 to help us improve this!
48+
This example configuration is only an example/suggestion. It may not be perfect, we haven't tested _all_ the use cases, so maybe the regular expressions will have to be tuned/improved if you find a false positive or a use case that those didn't catch. If that's the case, don't hesitate to contribute by at least commenting on https://github.com/SwiftGen/SwiftGen/issues/446 to help us improve this!
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Run SwiftGen every time a folder is changed
22

3-
To use SwiftGen we recommend that you [[use a Script Build Phase|Integrate-SwiftGen-in-an-xcodeproj]] to make sure your generated files are always in sync with your sources.
3+
To use SwiftGen we recommend that you [use a Script Build Phase](Xcode-Integration.md) to make sure your generated files are always in sync with your sources.
44

5-
But as an alternative, you might be interested in watching a specific directory instead, and invoke `swiftgen` when files in this watched directory change.
5+
But as an alternative, you may be interested in watching a specific directory instead, and invoke `swiftgen` when files in this watched directory change.
66

7-
* That prevents you to have to trigger a build to make your constants up-to-date after adding new files or strings for example (supposing that you start the watcher every time you start developing on you project to start the watching and auto-update of your files, though)
7+
* Prevents you having to trigger a build to make your constants up-to-date after (for example) adding new files or strings. This is supposing that you start the watcher every time you start developing on you project to start the watching and auto-update of your files.
88
* This can also be **super useful if you plan to create your own custom templates**, as it will allow you to watch your template file and iterate to check what the generated code looks like very time you modify and save your template, allowing some trial-and-error mode until you reach exactly the desired output.
99

1010
---
@@ -13,20 +13,20 @@ If you're interested in such a solution, we recommend to use [kicker](https://gi
1313

1414
## Examples
1515

16-
### Watch an Assts catalog and regenerate constants every time it changed
16+
### Watch your project resources and regenerate constants every time they change
1717

18-
To watch your Assets catalog folder and regenerate the constants for images every time your asset catalog is changed, you can use:
18+
To watch your resources folder and regenerate the constants for them every time your files have changed, you can use:
1919

2020
```sh
21-
kicker -e "swiftgen images -t swift3 -o Generated/Images-Generated.swift /path/to/Images.xcassets" /path/to/your/Images.xcassets
21+
kicker -e "swiftgen" /path/to/your/project/resources
2222
```
2323

2424
### Create a custom template and look at the generated code live as you edit and save it
2525

2626
And if you're writing a custom template, you can use a command similar to the following to watch the template file you're writing and auto-regenerate the output using that same template every time you modify it:
2727

2828
```sh
29-
kicker -e "swiftgen images -p /path/to/my/custom/template.stencil -o test-output.swift /path/to/Images.xcassets" /path/to/my/custom/template.stencil
29+
kicker -e "swiftgen xcassets --templatePath /path/to/my/custom/template.stencil --output test-output.swift /path/to/Images.xcassets" /path/to/my/custom/template.stencil
3030
```
3131

3232
This use of kicker (or any other tool allowing to do similar watching of a folder) can allow you to edit custom templates like you use Swift Playgrounds: you can split your screen or your favorite text editor (Sublime Text, Atom, …) in 2 windows, one containing the template you edit, the other containing the output, and see the test output on the second window being updated live.

Documentation/Articles/Xcode-Integration.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ To integrate SwiftGen directly in an Xcode project, and make it generate the fil
44

55
## Adding SwiftGen as a Run Script Phase
66

7-
You can read [Apple's dedicated documentation which explains how to add a Run Script Phase (with illustrations) here](https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/AddingaRunScriptBuildPhase.html)
8-
9-
In short, it consists of these steps:
7+
To add a build phase to your target, follow these steps:
108

119
* Select the project in the Project Navigator on the left of your Xcode window
1210
* Select your App Target in the list

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,21 +261,20 @@ This allows you to have a quick look at how typical code generated by SwiftGen l
261261

262262
### Dedicated Documentation in Markdown
263263

264-
There are also a lot of documentation in the form of Markdown files in this repository and the related [StencilSwiftKit](https://github.com/SwiftGen/StencilSwiftKit) repo as well.
264+
There is a lot of documentation in the form of Markdown files in this repository, and in the related [StencilSwiftKit](https://github.com/SwiftGen/StencilSwiftKit) repository as well.
265265

266266
Be sure to [check the "Documentation" folder](Documentation/) of each repository.
267267

268268
Especially, in addition to the previously mentionned [Migration Guide](Documentation/MigrationGuide.md) and [Configuration File](Documentation/ConfigFile.md) documentation, the `Documentation/` folder in the SwiftGen repository also includes:
269269

270-
* A [`Documentation/templates` subdirectory](Documentation/templates/) which details the documentation for each templates bundled with SwiftGen (when to use each template, what the output will look like, and custom parameters to adjust them, …)
271-
* A [`Documentation/SwiftGenKit Contexts` subdirectory](Documentation/SwiftGenKit%20Contexts/) which details the structure of the "Stencil Contexts", i.e. the Dictionary/YAML representation resulting of parsing your input files. This documentation is useful for people wanting to write their own templates, so that they know the structure and various keys available to write their template to construct the wanted generated output accordingly.
272-
* [Various articles](Documentation/Articles/) to provide good practice & tips on how to better take advantage of SwiftGen in your projects
270+
* A [`templates` subdirectory](Documentation/templates/) that details the documentation for each of the templates bundled with SwiftGen (when to use each template, what the output will look like, and custom parameters to adjust them, …)
271+
* A [`SwiftGenKit Contexts` subdirectory](Documentation/SwiftGenKit Contexts/) that details the structure of the "Stencil Contexts", i.e. the Dictionary/YAML representation resulting of parsing your input files. This documentation is useful for people wanting to write their own templates, so that they know the structure and various keys available when writing their template, to construct the wanted generated output accordingly.
272+
* [Various articles](Documentation/Articles/) to provide best practices & tips on how to better take advantage of SwiftGen in your projects:
273273
* [Integrate SwiftGen in your Xcode project](Documentation/Articles/Xcode-Integration.md) — so it rebuilds the constants every time you build
274274
* [Configure SwiftLint to help your developers use constants generated by SwiftGen](Documentation/Articles/SwiftLint-Integration.md)
275275
* [Create a custom template](Creating-your-templates.md), and [watch a folder to auto-regenerate an output every time you save the template you're working on](Documentation/Articles/Watch-a-folder-for-changes.md)
276276
* …and more
277277

278-
279278
### Tutorials
280279

281280
You can also find other help & tutorial material on the internet, like [this classroom about Code Generation I gave at FrenchKit in Sept'17](https://github.com/FrenchKit/Mastering-code-generation-Classroom) — and its wiki detailing a step-by-step tutorial about installingn and using SwiftGen (and Sourcery too)
@@ -697,12 +696,10 @@ let bananas = L10n.bananasOwner(5, "Olivier")
697696

698697
---
699698

700-
701699
# License
702700

703701
This code and tool is under the MIT License. See the `LICENSE` file in this repository.
704702

705-
706703
## Attributions
707704

708705
This tool is powered by

0 commit comments

Comments
 (0)