Post

Replies

Boosts

Views

Activity

Reply to Tab bar item localization
The extension of string is like so: extension String {   func localize() - String {     return NSLocalizedString(       self,       tableName: "Localizable",       bundle: .main,       value: self,       comment: self)   }       public func localize(with arguments: [CVarArg]) - String {     return String(format: self.localize(), locale: nil, arguments: arguments)   } } Most of my localisation is in Localizable.strings and hoped I could localize from there. But as you said, I might as well create Main.strings files and do the localization in there for those titles. I wanted to avoid creating other files, but it really isn't a problem in the end.
May ’21
Reply to Tab bar item localization
class LevelsViewController: UIViewController {  override func viewDidLoad() {     super.viewDidLoad() tabBarItem.title = "LevelsVC-TabBarItem".localize() } } Here is an example. LevelsViewController is a view controller that is displayed when tapping a tab bar item.
May ’21
Reply to Tab bar item localization
2 titans, and now a god :) This forum is underrated. Thanks for your suggestions Developer Tools Engineer. You are very right, I got myself into maintaining my own Localizable.strings file with commenting each line in there. Fortunately the project is not too big, but for the next one, I will certainly do it the right way from the start.
May ’21
Reply to What is the earliest method to put in and trigger a performSegue?
Sure. VC1 is entry of app. I only need that in the stack so I can unwind later to it VC1 only action is the performeSegue to VC2. VC2 is the main controller of app with lots of work and variables alive. When a user logs out of the app, I need all states to be destroyed. I found the simplest way, instead of setting each variable to default when the user logs out, is to unwind to VC1 (so VC2 is destroyed) then VC1 immediately loads VC2, fresh, with all variables on their default values. So the goal is to perform segue to VC2 from VC1 as fast as possible so users don't even see VC1. That may not be the most legit way to achieve this, but the unwind makes absolutely certain that all states of VC2 die.
May ’21