In iOS 12 and 13, up to 13.4, few lines of codes:
navigationController?.navigationBar.isTranslucent = false
navigationController?.navigationBar.barTintColor = .black
navigationController?.navigationBar.tintColor = .red
allow to hide the status bar under the navigation bar.
With swiftUI is perhaps even simpler
.statusBar(hidden: hideStatusBar)
but it requires to rewrite the whole app from storyboard to swiftUI.
Hiding the status bar, or go to full screen, is still be possible without using swiftUI on legacy code?
I found the issue origin, which is correlated to the Dark Mode (that I had inadvertently changed)
The 2 codes' lines:
navigationController?.navigationBar.isTranslucent = false
navigationController?.navigationBar.barTintColor = .black
determine a dark background of the statusBar.
In Light Mode the StatusBar foregroundColor is black so it disappers, in Dark Mode it's white, so it emerge on the dark background.
These two settings into info.plist turn off the initial statusBar and don’t turn it on later:
UIStatusBarHidden (Status bar is initially hidden) YES
UIViewControllerBasedStatusBarAppearance (View controller-based status bar appearance) NO
(from h ttps://stackoverflow.com/questions/18979837/how-to-hide-ios-status-bar/18980833#18980833)
Thank you Claude for your patiently support.