-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathIcons.stencil
41 lines (37 loc) · 1.43 KB
/
Icons.stencil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// swiftlint:disable all
// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen
{% if catalogs %}
{% set enumName %}{{param.enumName|default:"Asset"}}{% endset %}
{% set forceNamespaces %}{{param.forceProvidesNamespaces|default:"false"}}{% endset %}
{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %}
{% macro enumBlock assets %}
{% call casesBlock assets %}
{% endmacro %}
{% macro casesBlock assets %}
{% for asset in assets %}
{% if asset.type == "image" %}
static var {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}: Image {
return {{enumName}}.Icons.{{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}}.swiftUIImage
}
{% elif asset.items and ( forceNamespaces == "true" or asset.isNamespaced == "true" ) %}
{% call casesBlock asset.items %}
{% elif asset.items %}
{% call casesBlock asset.items %}
{% endif %}
{% endfor %}
{% endmacro %}
import SwiftUI
// swiftlint:disable identifier_name line_length nesting type_body_length type_name
{{accessModifier}} extension Image {
{% if catalogs.count > 1 or param.forceFileNameEnum %}
{% for catalog in catalogs %}
{% call enumBlock catalog.assets %}
{% endfor %}
{% else %}
{% call enumBlock catalogs.first.assets %}
{% endif %}
}
// swiftlint:enable identifier_name line_length nesting type_body_length type_name
{% else %}
// No assets found
{% endif %}