superarts / XStringCatalog

A framework that generates enum from xcstring - Swift enumerations from String Catalog for iOS / iPadOS / macOS / tvOS.
MIT License
4 stars 9 forks source link

XStringCatalog

A framework that generates enum from xcstrings - Swift enumerations from String Catalog for iOS / iPadOS / macOS / tvOS.

If you are not familiar with Apple's String Catalog (introduced from Xcode 15 - WWDC 23), please check Apple's workflow first.

Contents

Workflow

Appendix

This section provides context and high order thinking, which can be ignored by senior developers.

Apple's workflow and why it's bad

Workflow

Apple's bare minimum localization implementation is to reuse the mechanisms based on Localizable Strings, and makes it easier to use. Typical workflow is like:

Advantage against the old Localizable String approach

Why Apple's approach is bad

Or I should say why it's only good to build a MVP app. As long as you have built an app with decent level of complexity, you should have encountered use cases like:

General thinking about Apple's tech stack

Apple usually doesn't promote certain design patterns. Most of the time, Apple only offers the essential components for you to build your system. This could lead to some bad results, for example, most of experienced iOS developers perhaps have seen massive view controllers more or less. Another example is that Google built components like LiveData, Room etc. and promoted their own MVVM pattern. Apple rarely does that.

I think this is because Apple, at its core, is a company that sells products. It offers tools to build apps for its products, but in the end, implementation is not what Apple is passionate about. Apple probably cares about backward compatibility more, as it does impact the products. So you don't see Apple is promoting using enum over hard-coded strings in their examples, and it doesn't mean you shouldn't do it yourself.

Companies like Google, on the other hand, are built around technology. They don't hesitate to kill their services and update their tech stack, which sometimes results confusion and frustration. But they do offer more software architectural level of thinking, which can be insightful for developers in their ecosystems.

Of course, this is just a high level summary. Apple built async/wait APIs to promote better codes, and Google still uses XML (bah) for string resources. And just like iOS and Android, we are seeing both parties learn from each other. Hopefully technology will keep evolving.

Credit