‘windows’ was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead” warning in Swift.
Aug 28, 2023
I have a scenario where i need to change the status bar color to light in all screen( Controller )
UIApplication.shared.windows.forEach { window in
if #available(iOS 13.0, *) {
window.overrideUserInterfaceStyle = .light
} else {
// Fallback on earlier versions
}
}

Quick fix for this above warning:
let scenes = UIApplication.shared.connectedScenes
let windowScene = scenes.first as? UIWindowScene
windowScene?.windows.forEach { window in
if #available(iOS 13.0, *) {
window.overrideUserInterfaceStyle = .light
} else {
// Fallback on earlier versions
}
}