Permalink
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (14 sloc) 767 Bytes
// swiftlint:disable vertical_whitespace
{% for type in types.implementing.AutoEquatable|class %}
extension {{ type.name }} {
/// :nodoc:
override {{ type.accessLevel }} func isEqual(_ object: Any?) -> Bool {
guard let rhs = object as? {{ type.name }} else { return false }
{% for variable in type.storedVariables|!annotated:"skipEquality" %}if self.{{ variable.name }} != rhs.{{ variable.name }} { return false }
{% endfor %}
{% for variable in type.computedVariables|annotated:"forceEquality" %}if self.{{ variable.name }} != rhs.{{ variable.name }} { return false }
{% endfor %}
{% if type.inheritedTypes.first == "NSObject" %}return true{% else %}return super.isEqual(rhs){% endif %}
}
}
{% endfor %}