Enum template
This commit is contained in:
parent
07d5943746
commit
8d96730e64
|
|
@ -0,0 +1,23 @@
|
|||
{%- import 'swift-utils.twig' as utils -%}
|
||||
|
||||
import Foundation
|
||||
|
||||
/// {{ description }}
|
||||
///
|
||||
{% for value in values -%}
|
||||
/// - {{ utils.decapitalize(value.name) }}: {{ value.description }}
|
||||
{% endfor -%}
|
||||
enum {{ name }}: {% if valuesTypes == "STRING" -%}
|
||||
String
|
||||
{%- elseif valuesTypes == "INT" -%}
|
||||
Int
|
||||
{%- endif %} {
|
||||
|
||||
{% for value in values -%}
|
||||
case {{ utils.decapitalize(value.name) }} = {% if valuesTypes == "STRING" -%}
|
||||
"{{ value.value }}"
|
||||
{% else %}
|
||||
{{- value.value }}
|
||||
{% endif -%}
|
||||
{% endfor %}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{% macro decapitalize (text) %}
|
||||
{{- concat(slice(text, 0, 1) | lower, slice(text, 1, text | length)) -}}
|
||||
{% endmacro %}
|
||||
Loading…
Reference in New Issue