change color of status bar swift navigation controller code example
Example 1: swift change navigation bar color
navigationController?.navigationBar.barTintColor = UIColor.green
navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.orange]
tabBarController?.tabBar.barTintColor = UIColor.brown
tabBarController?.tabBar.tintColor = UIColor.yellow
Example 2: swift change status bar color
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setNeedsStatusBarAppearanceUpdate()
}
override var preferredStatusBarStyle: UIStatusBarStyle {
.lightContent
}