How to manage Localized Strings in your Project

How to manage Localized Strings in your Project

Marius Hartig

We want to create for each ViewController a Enum as collection for our Localized String Keys, this will look like that.

we want all strings in one file for example (Strings.swift) in this file we can add strings via extensions to our ViewControllers


For a better structure and to solve name conflicts we need a namespace for each ViewController. So wee need a other Protocol let us call this StringLocalizeable.


Now we have to implement in our Strings Enum the StringLocalizeable Protocol we need changes in the PorfileViewController and in the Strings Protocol.


Strings need as RawValue Type a String


add a different namespace for each ViewController Strings


Our Localizable.strings looks with namespace like that

we can use also arguments for our strings





Report Page