-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
My stencil file:
// sourcery:inline:auto:{{ type.name }}.init
public init({% for variable in type.storedVariables %}{{variable.name}}: {{variable.typeName}}{% ifnot forloop.last %}, {% endif %}{% endfor %}) {
{% for variable in type.storedVariables %}
self.{{variable.name}} = {{variable.name}}
{% endfor %}
}
// sourcery:end
{% endfor %}
{% for type in types.all where type|annotated:"isEqual" %}
// sourcery:inline:auto:{{ type.name }}.isEqual
override public func isEqual(to object: Any?) -> Bool {
guard let other = object as? {{type.localName}} else { return false }
return {% for variable in type.storedVariables %}{{variable.name}} == other.{{variable.name}}{% ifnot forloop.last %} &&
{% endif %}{% endfor %}
}
override public var hash: Int {
var hasher = Hasher()
{% for variable in type.storedVariables %}
hasher.combine({{variable.name}})
{% endfor %}
return hasher.finalize()
}
// sourcery:end
{% endfor %}
Looks like this:
https://user-images.githubusercontent.com/8356175/102830624-05952200-43ea-11eb-8990-34165a1f17cf.png
Same result with current version from marketplace and the version in #2
Metadata
Metadata
Assignees
Labels
No labels