UniversalMappable conformance

This commit is contained in:
Ivan Smolin 2018-04-17 20:48:14 +03:00
parent d686c41cab
commit b6fd40f30f
1 changed files with 14 additions and 1 deletions

View File

@ -60,7 +60,20 @@ import LeadKit
}
{% if (not hasChilds) and (not hasGenerics) and (not fieldsHasGenericsOrNonEqutableCollections) -%}
{% if not hasChilds %}
extension {{ type.baseTypeName }}: UniversalMappable {
static func decode(from map: Map, key: String) throws -> {{ type.baseTypeName }} {
return try map.value(key)
}
}
{{ "\n" }}
{%- endif -%}
{%- if (not hasChilds) and (not hasGenerics) and (not fieldsHasGenericsOrNonEqutableCollections) -%}
extension {{ type.baseTypeName }}: Equatable {
static func ==(lhs: {{ classType }}, rhs: {{ classType }}) -> Bool {