Reply to 'windows' was deprecated in iOS 15.0: Use UIWindowScene.windows? if let window = UIApplication.shared.connectedScenes.map({ $0 as? UIWindowScene }).compactMap({ $0 }).first?.windows.first { } try this solution it's work for me UI Frameworks UIKit Nov ’22