Fix structured-swift5 template when having the Type keyword in a string #1131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
develop
branch (gitflow)develop
as the "base" branch for this Pull Request I'm about to createCHANGELOG.md
file to explain my changes and credit myself(or added
#trivial
to the PR title if I think it doesn't warrant a mention in the CHANGELOG)👋 Hey,
I was using SwiftGen for strings and I realized that there is a bug when having a string key containing
type
as a keyword such as this onedashboard.item.type.item
. It creates aenum `Type`
but for some reason that seems to come from a Swift bug, it's not usable withL10n.Dashboard.Item.`Type`.item
as it ends up with a compiler error.To fix that, I added a condition in the
structured-swift5.stencil
so thetype
keyword is handled as a number would be. That way we would haveenum _Type
instead which works as expected. With this fix, we would have to use the previous example this wayL10n.Dashboard.Item._Type.item
.I know this might not seem like the best solution, but as it seems to be a Swift bug, I don't think we have another option.