kaandedeoglu / Shark

Swift CLI for strong-typing images, colors, storyboards, fonts and localizations
MIT License
381 stars 15 forks source link

Enforcement `CaseIterable` needs to be optional #48

Closed 404wasfound closed 1 year ago

404wasfound commented 1 year ago

By making all the enums CaseIterable you essentially breaking all the projects which have their resources separated in different folders, cause now all the resources of the same type are under one huge enum, instead of the nested ones. Have to fork the tool to fix it now.

mickeyl commented 1 year ago

I'm not sure I understand that. The nesting is independent from the attribute CaseIterable. Can you show me a diff for you between an older version and a newer one, so I can see how it breaks?

404wasfound commented 1 year ago

hey there @mickeyl! thanx for the response! tbh do not even know how to show the entire thing, will share a screenshot with some parts of the diff so you have a better idea

So we used to have all the resources separated in folders, on that screenshot you see the deleted parts of previously generated enum for images

Screenshot 2022-11-07 at 16 50 56

And now all the resources are just under one resource specific enum (I, C etc.)

Screenshot 2022-11-07 at 16 52 55
404wasfound commented 1 year ago

So if we take for example the very first case from the screenshot with deleted parts, ic_standard_business, in the code we referenced it as I.Address.ic_standard_business, but now it is just I.standard_business. Naturally that happened to all the resources.

Imho previous approach was better especially for the projects with tons of different resources, was way easier to navigate and find resources case enums reflected the folder structure in resources.

mickeyl commented 1 year ago

@404wasfound Ah, I think this is due to the new corrected folder handling. Please have a look at the README again. If you want Shark to turn a folder into a namespace, you need to check the [x] Provides Namespace below

for every folder you're using. Previously, Shark did create a namespace for every folder, no matter whether the checkbox was ticked or not. The new behavior is correct, although it requires you to adjust your projects. Sorry for the inconvenience.

Please check after checking the folder checkboxes whether this returns your Shark file to the previous state.

404wasfound commented 1 year ago
provided you have configured the respective Xcode setting Provides Namespace

ooohhhh now I see ... so the previous folders handling was not correct? will try it now, thank you for the info and sorry for bothering!

404wasfound commented 1 year ago

@mickeyl worked, thank you very much!