Shark icon indicating copy to clipboard operation
Shark copied to clipboard

Make enums CaseIterable

Open denizdogan opened this issue 3 years ago • 4 comments

I'm not sure if this is actually possible, but can we make the generated enums conform to CaseIterable? The use case here is that I have a list of images in my preview assets for testing purposes, and I need to put them in a long list. Without CaseIterable, I need to manually make the array of images.

denizdogan avatar May 02 '22 15:05 denizdogan

I can certainly see a use case for that. Merging https://github.com/kaandedeoglu/Shark/tree/namespaced_color_assets would be a requirement though, since it contains a refactoring towards a common enum builder.

Unfortunately this no longer applies cleanly, as I started my work on the framework-specific code generation without knowing of the existence of this very branch.

mickeyl avatar May 03 '22 10:05 mickeyl

@mickeyl I thought it would be enough to just add a configuration option here, similar to #44? Kind of like --case-iterable would slap CaseIterable onto every enum?

denizdogan avatar May 03 '22 11:05 denizdogan

@denizdogan I figured we can just conform unconditionally to CaseIterable. We don't need it for the localizable strings though, or do we?

mickeyl avatar Aug 29 '22 08:08 mickeyl

@mickeyl Not as far as I know

denizdogan avatar Aug 29 '22 09:08 denizdogan

This is now life as per the 1.6.0 release.

mickeyl avatar Sep 23 '22 14:09 mickeyl