Created
January 24, 2018 09:37
-
-
Save Stickerbox/a491df6c312d852a9d7d2efaae03a6fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for struct in types.all.implementing.Codable|struct %} | |
{% ifnot struct.annotations.ignore %} | |
extension {{ struct.name }} { | |
enum CodingKeys: String, CodingKey { | |
{% for var in struct.storedVariables %} | |
{% if var.annotations.key %} | |
case {{ var.name }} = "{{ var.annotations.key }}" | |
{% endif %} | |
{% ifnot var.annotations.key %} | |
case {{ var.name }} | |
{% endif %} | |
{% endfor %} | |
} | |
} | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment