This tutorial explains the relationship between UIWindowScene
, UIWindow
, and UIScene
, and shows how to create a secondary debug window using SwiftUI inside a UIKit-hosted UIWindow
. This is especially useful for developers working on internal tools or debugging overlays for iOS, iPadOS, or visionOS apps.
Apple's scene-based lifecycle (introduced in iOS 13) allows multiple UI scenes per app. Each scene is an instance of UIScene
, and for UIKit-based apps, it takes the form of a UIWindowScene
. Each UIWindowScene
can own multiple UIWindow
instances.