‘windows’ was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead” warning in Swift.

Sathish Kumar
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
}
}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Sathish Kumar
Sathish Kumar

Written by Sathish Kumar

Hands on experience in iOS | Swift UI

No responses yet

Write a response