‘windows’ was deprecated in ios 15.0: use uiwindowscene.windows on a relevant window scene instead

The ‘windows’ property in iOS 15.0 has been deprecated. Instead, you should use the ‘uiwindowscene.windows’ property on a relevant window scene. This change was introduced to improve the management and organization of windows within a scene in iOS applications.

The ‘windows’ property in iOS allowed direct access to the array of windows associated with the application. However, with the introduction of the new ‘uiwindowscene’ API, windows are now managed in a scene-based manner. Each window scene represents a distinct user interface of an app, such as the main interface or a secondary interface.

To access the windows associated with a particular window scene, you can use the ‘uiwindowscene.windows’ property. This property returns an array of ‘uiwindow’ objects representing the windows currently attached to the scene.

Here’s an example of how you can use the ‘uiwindowscene.windows’ property:


      let scene = UIApplication.shared.connectedScenes.first
      if let windowScene = scene as? UIWindowScene {
         let windows = windowScene.windows
         // Access and manipulate the windows array as needed
      }
   

Read more interesting post

Leave a comment