Created
July 7, 2023 17:01
-
-
Save nevillco/aec0c67a7457a99fb220336614bc8184 to your computer and use it in GitHub Desktop.
StaticMemberIterable as Sourcery template
This file contains hidden or 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
| <% let implementingTypes = types.all.filter { $0.annotations["StaticMemberIterable"] != nil } -%> | |
| <% for type in implementingTypes { -%> | |
| <%_ %>// MARK: - <%= type.name %> | |
| <%_ %>extension <%= type.name %> { | |
| static let allCases: [Self] = [ | |
| <%_ let variables = type.staticVariables.sorted { $0.name < $1.name } -%> | |
| <%_ for variable in variables { _%><%_ -%> | |
| .<%= variable.name %>, | |
| } | |
| <%_ } _%>]<% -%> | |
| <%_ %>} | |
| <% } %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment