Avatar ·

How to fix the 'keyWindow' was deprecated in iOS 13.0 warning in Swift?

Hi everyone! I'm a beginner iOS developer writing an app in Swift. After updating Xcode and switching to iOS 13, I ran into a problem. Previously, I could easily access the main app window via `UIApplication.shared.keyWindow`, but now the compiler gives a warning: ``` 'keyWindow' was deprecated in iOS 13.0: Use UIWindowScene.windows on a relevant window scene instead ``` Here's my code where I use `keyWindow` to display a loading indicator over the entire interface: ```swift func showLoadingIndicator() { if let window = UIApplication.shared.keyWindow { let loadingView = UIView(frame: window.bounds) loadingView.backgroundColor = UIColor.black.withAlphaComponent(0.5) // adding indicator window.addSubview(loadingVie