Change languages inside the app no need to wait the screen to reboot any more
DPLocalized
Change languages inside the app, no need to wait the screen to reboot any more.
Usage
First of all, the app needs to support multi-language, or another professional word "Localizations" in Xcode project.
Add notifications, to reload data of current page, or previous pages in the memory
func addNotifications() {
NotificationCenter
.default
.addObserver(self, selector: #selector(languageDidChange(_:)),
name: DPNotification.languageDidChange, object: nil)
}
deinit {
NotificationCenter
.default
.removeObserver(self, name: DPNotification.languageDidChange, object: nil)
}
@objc func languageDidChange(_ notification: Notification) {
tableView.reloadData()
}
Then add this line to the entry, it will open the language setting menu
DPLanguageManager.shared.popup(self)
And for the strings need to be localized, there is a syntax sugar in extension
"puppy".localized
And that's all. Thanks