import UIKit @objc(SceneTrapApp) final class SceneTrapApp: UIResponder, UIApplicationDelegate {} // Synthetic regression app: leaving the foreground must be caught by survive. @objc(SceneTrapScene) final class SceneTrapScene: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options: UIScene.ConnectionOptions) { guard let scene = scene as? UIWindowScene else { return } let view = UIViewController() let label = UILabel(frame: CGRect(x: 20, y: 100, width: 300, height: 50)) label.text = "Synthetic database" label.accessibilityIdentifier = "bar-search" view.view.backgroundColor = .white view.view.addSubview(label) window = UIWindow(windowScene: scene) window?.rootViewController = view window?.makeKeyAndVisible() } @inline(never) func sceneDidEnterBackground(_ scene: UIScene) { fatalError("Synthetic scene-phase trap") } } UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, NSStringFromClass(SceneTrapApp.self))