another.im-ios/.swiftgen/templates/xcassets.stencil
2024-06-19 17:15:27 +02:00

49 lines
1.4 KiB
Plaintext

// swiftlint:disable all
// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen
{% if catalogs %}
import SwiftUI
{% macro casesBlock assets %}
{% for asset in assets %}
{% if asset.items and asset.isNamespaced == "true" %}
public enum {{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} {
{% filter indent:2 %}{% call casesBlock asset.items %}{% endfilter %}
}
{% elif asset.items %}
{% call casesBlock asset.items %}
{% elif asset.type == "color" %}
public static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = Color("{{asset.value}}")
{% elif asset.type == "image" %}
public static let {{asset.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = Image("{{asset.value}}")
{% endif %}
{% endfor %}
{% endmacro %}
{% for catalog in catalogs %}
{% if catalog.name == "Colors" %}
extension Color {
{% for catalog in catalogs %}
{% if catalog.name == "Colors" %}
{% call casesBlock catalog.assets %}
{% endif %}
{% endfor %}
}
{% endif %}
{% endfor %}
{% for catalog in catalogs %}
{% if catalog.name == "Images" %}
extension Image {
{% for catalog in catalogs %}
{% if catalog.name == "Images" %}
{% call casesBlock catalog.assets %}
{% endif %}
{% endfor %}
}
{% endif %}
{% endfor %}
{% else %}
// No assets found
{% endif %}
// swiftlint: enable all