TestingSceneDelegate.swift 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // TestingSceneDelegate.swift
  3. // ark_ui_basic
  4. //
  5. // Status: Complete for iOS
  6. #if os(iOS) || os(visionOS)
  7. import UIKit
  8. // MARK: - TestingSceneDelegate [6.4.41] [iOS]
  9. class TestingSceneDelegate: DelegateBaseClass, UIWindowSceneDelegate {
  10. var window: UIWindow?
  11. var comparisonWindow: UIWindow?
  12. static var connectCallback: ((UIWindow, UIWindow) -> Void)?
  13. override init() {
  14. self.window = nil
  15. self.comparisonWindow = nil
  16. super.init()
  17. }
  18. func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
  19. guard window == nil,
  20. let windowScene = scene as? UIWindowScene else {
  21. return
  22. }
  23. let window = UIWindow(windowScene: windowScene)
  24. self.window = window
  25. let comparisonWindow = UIWindow(windowScene: windowScene)
  26. self.comparisonWindow = comparisonWindow
  27. guard let connectCallback = TestingSceneDelegate.connectCallback else {
  28. return
  29. }
  30. connectCallback(window, comparisonWindow)
  31. }
  32. }
  33. #endif