add init(from:) for classes with superclasses

This commit is contained in:
Madhas 2018-05-21 19:06:16 +03:00
parent 3e04e32ce7
commit b07ea34f57
1 changed files with 9 additions and 0 deletions

View File

@ -27,6 +27,15 @@ import LeadKit
{%- endif %}
}
{% if hasParent %}
required init(from decoder: Decoder) throws {
{%- if fields is not empty %}
{% include 'blocks/class/fields-initialization-from-decoder.twig' with { fields: fields} %}
{% endif %}
try super.init(from: decoder)
}
{% endif %}
{% if (not hasGenerics) and (not fieldsHasGenericsOrNonEqutableCollections) -%}
func isEqual(to other: {{ classType }}?) -> Bool {
guard let other = other else {