First set in info.list
View controller-based status bar appearance = NO
Then set the status bar font color is white or black
UIApplication.shared.statusBarStyle = UIStatusBarStyle.default;
OR
UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent;