Set your darkMode variable using the same code you have now, then use it in the computed variable that the system is expecting:
var darkMode = false
override var preferredStatusBarStyle : UIStatusBarStyle {
return darkMode ? .default : .lightContent
}
Depending on the context you may need to force a refresh of the screen for it to take effect. You would do that with the following call:
setNeedsStatusBarAppearanceUpdate()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…