-
Notifications
You must be signed in to change notification settings - Fork 38
Conversation
fceda0a
to
3c19f4b
Compare
3c19f4b
to
1e18d17
Compare
This template is the default template used by SwiftGen when parsing images in Asset Catalogs. | ||
It generates Swift 3 code and is suitable for most needs. | ||
|
||
## Customization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should now actually separate that section to show both --param
and ENV
possible customizations (maybe in the same section, but find a way to make them both visible anyway)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the whole explanation about "customize using --param" and that we load ENV variables, should be in the SwiftGen documentation itself. Here we should only document what is accepted (and in some cases "why"), and link to the swiftgen docs on how to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed.
| Name | Description | | ||
| --------- | ----------------- | | ||
| File name | images-default.stencil | | ||
| Invocation example | `swiftgen storyboard -t default …` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should b swiftgen images …
instead, obviously
## When to use it | ||
|
||
This template is the default template used by SwiftGen when parsing images in Asset Catalogs. | ||
It generates Swift 3 code and is suitable for most needs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think of it, when I thought about adding that section at first, is was more to say:
"This template is more suitable for when you name your images with underscores" or "This template is more suitable for when you use that "provides namespace" checkbox on the folders inside your xcasset catalog", and "this template supports multiple catalogs by creating a separate enum for each catalog", stuff like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we getting rid of the flat images enum in 5.0? #11
I get the intention though, but think that quite a few recommendations won't be needed once we remove the old stuff. Some options will probably remain, like the flat strings version, and can provide recommendations for those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that PR was opened before we even decided to get rid of the "default" behavior even.
Again the idea behind this paragraph, which would be probably more useful for the strings templates especially, is to tell which template to use depending on which banking conventions you have as input (how you name your strings keys for example, are you the kind of people that use all-caps keys, or keys structured with dots or underscore to separate the key parts, etc… and what do you expect as output (structured, not structured…)
Might be less relevant for images template because the naming doesn't impact the structural split (the organisation of the assets catalog does), but you get the idea. Because not everyone has the same naming and organization conventions the aim is to help people choose the right template for them.
<summary>Full generated code</summary> | ||
|
||
```swift | ||
(the full code here) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(or a link to the "expected output" fixture)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have the output files for testing, and because they are prone to change, it might be best to just link to them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the full code I totally agree.
For the extract it would be nice if we could try to keep it here in that documentation and try to keep it uo to date, because it allows people to see it at a glance.
I wanted to work on the documentation today, but am not sure how much worth it is, as we'll be removing quite a few things once we work on 5.0. Do I only document the templates we want to keep for 5.0? |
I think it's only worth working on documenting templates we intend to keep. No need to document things (templates, tags, filters or anything) that we intend to drop in 5.0 |
1e18d17
to
fbbedff
Compare
a46d637
to
8d1999d
Compare
a0aa747
to
eaa66b8
Compare
My view on those sections is to be a checklist for users to see if their situation or the way they use/write the input files matches what is expected by the templates. For example for strings template, depending on if you're using dot-syntax in your Localizable.strings or not, you might want one template or the other, so that section is supposed to tell you which template to use depending on how you write your keys. In future other string templates we might add bullet points like "If you use underscores in your key names" or "if all your keys in your Localizable.strings are all full-uppercase", etc.
ef345f3
to
a076000
Compare
Documentation/strings/default.md
Outdated
## When to use it | ||
|
||
- When you need to generate *Swift 2* code | ||
- If you use unstructured keys for your strings, or a structure that we don't support (yet). If you use "dot-syntax" keys, please check out the [dot-syntax](dot-syntax.md) template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"unstructured key names"?
a076000
to
4208973
Compare
Documentation/strings/default.md
Outdated
|
||
## Customization | ||
|
||
You can customise some elements of this template by overriding the following parameters when invoking `swiftgen` in the command line, using `--param <paramName> <newValue>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/customise/customize/, right? (applies on every doc file)
As discussed in SwiftGen/SwiftGen#232