Resource Management: xcres
Join the DZone community and get the full member experience.Join For Free
Well, this is the handy-dandiest resource helper we’ve seen in a while:
xcres searches your Xcode project for resources and generates an index as struct constants. So you will never have to reference a resource, without knowing already at compile time if it exists or not.
It includes loose images, .bundles, asset catalogs (.xcasset) and even .strings in the index.
It gives you code autocompletion for resources and localized string keys, without the need of an Xcode plugin.
Especially if your app is a bit more complex, this will greatly improve your workflow. It ensures a better quality and gives you more safety. You will see directly when a resource is missing, when you renamed it, or you moved it around.
Furthermore it won’t even bother you for trivial name changes like change capitalization or converting name scheme from train-case or snake_case to camelCase and vice versa.
It will warn you in Xcode on build, if certain resources or string keys can’t be references, because their name contain invalid chars, duplicates in the camelCase variant with another key, or would be equal to a protected compiler keyword…
We tend to keep our resource references pretty much in order by reflex when writing them actually, but looks like this might make that more streamlined. And looks like it would be downright invaluable the next time we’re handed some mess to make sense of written by someone who regarded the concept of ‘maintainability’ with fear and loathing apparently…
Published at DZone with permission of Alex Curylo, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.