Skip to content
Snippets Groups Projects
Commit 58d56814 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Generate value getter method

parent e020b51a
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,20 @@ extension {{class.name}}
fatalError("Cannot set value for key \(key)")
}
}
@objc {% if class.needsMethodOverride %} override {% endif %} func getValueByKey(key: String) -> Any?
{
switch key {
{% for variable in class.variables %}
{% if not variable.constant and not variable.privateVisibility and not variable.staticModifier and not variable.hasAccessor %}
case "{{variable.name}}":
return self.{{ variable.name }}
{% endif %}
{% endfor %}
default:
fatalError("Cannot set value for key \(key)")
}
}
}
{% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment