You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello stencil team!
i am working with stencil in the context of a custom swiftgen template.
i am attempting to iterate over a list of dictionaries and extract all the unique keys which will then represent the cases of an enum.
something like this:
{% macro extractUniqueKeys dictionaries %}
public enum AnalyticsPropertyKey: String {
{% for dict in dictionaries %}
{% for key,value in dict %}
// Only want to execute setting key name and declaring case if I haven't already found that key!
{% set keyName %}{{key|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}{% endset %}
case {{keyName}} = "{{key}}"
{% endfor %}
{% endfor %}
}
{% endmacro %}
Is there a way to do this? I also asked on the swiftgen repo, too, in case that's the better forum. thank you!
The text was updated successfully, but these errors were encountered:
hello stencil team!
i am working with stencil in the context of a custom swiftgen template.
i am attempting to iterate over a list of dictionaries and extract all the unique keys which will then represent the cases of an enum.
something like this:
Is there a way to do this? I also asked on the swiftgen repo, too, in case that's the better forum. thank you!
The text was updated successfully, but these errors were encountered: