Reputation: 20379
I have multiple storyboards in my project. Lets say one of them is Main.storyboard
. I have few hard coded strings in Main.storyboard
. Because we are trying to create a white labeled app, I have added multiple targets to existing project.
Now each target uses the same Main.storyboard
because there is no change in UI. But I need to customize the hardcoded strings in Main.storyboard
to each target.
For example in Target A strings should say "Welcome to A" when built for TargetB string should be "Welcome to B".
One way I can think of is creating IBOutlet
to each such UIComponent
and update their value dynamically by adding if else
statements or easy way would be enable localization to Main.storyboard
and have different Main.strings
file for each target.
I would prefer using 2nd approach but I dont know how to achieve it. Any help would be greatly appreciated. No need of code in here hence not adding any snippet. If you need screen shot of project structure lemme know :)
Upvotes: 1
Views: 240
Reputation: 14040
Localizable.strings
file for each targetLocalizable.strings
file with a common key but different textNSLocalizedString
functionUpdate:
Instead of Localizable.strings
you could also add Main.strings
(name depends on your storyboard name) files for each target. In those files you can then set texts for specific UI elements by using {element_identifier}.text
as the key. You find the identifier by right clicking the storyboard -> "Open As" -> "Source Code".
Upvotes: 1