api-generator-templates/Swift/macroses/class.utils.twig

30 lines
791 B
Twig

{% macro typeParameters(parameters) %}
{%- import '../macroses/common.utils.twig' as utils -%}
{%- if parameters is not empty -%}
<
{%- for typeParameter in parameters %}
{{- utils.formatValueType(typeParameter) -}}{%- if not (loop.last) %}, {% endif %}
{%- endfor -%}
>
{%- endif -%}
{% endmacro %}
{% macro classType(type) %}
{%- import _self as self -%}
{{- type.baseTypeName -}}{{- self.typeParameters(type.typeParameters) -}}
{% endmacro %}
{% macro parentClassType(parent, parentTypeParameters) %}
{%- import _self as self -%}
{%- if parent is not null %}
{{- parent.type.baseTypeName -}}
{%- else -%}
ImmutableMappable
{%- endif -%}
{{- self.typeParameters(parentTypeParameters) -}}
{% endmacro %}