After a long search, I found the answer to fix the problem of the change navigation bar and tab bar color, tint color, and font in run time when the user chooses a specific color.
to change the color of the navigation bar:
use this to change the color of navbar for the current screen
navigationController?.navigationBar.barTintColor = Color
and that for changing the color for navbar in the entire app
UINavigationBar.appearance().tintColor = Color
UINavigationBar.appearance().barTintColor = Color
and this for changing navbar font for the current screen
navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: AppFont().large]
and this for the entire app
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: AppFont().large]
and this for change tab bar tint color
self.tabBarController?.tabBar.tintColor = Color.theme.value
and this to change tab bar items font
let selectedAttrs = [NSAttributedString.Key.font: Font, NSAttributedString.Key.foregroundColor: Color]
if let items = self.tabBarController?.tabBar.items {
for item in items {
item.setTitleTextAttributes(selectedAttrs, for: .selected)
}
}
https://gph.is/g/ZOR7bAP