Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions Sources/Public/Setup/Public+Setup+SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import SwiftUI
open class PopupSceneDelegate: NSObject, UIWindowSceneDelegate {
open var window: UIWindow?
open var configBuilder: (GlobalConfigContainer) -> (GlobalConfigContainer) = { _ in .init() }
open func sceneStoppedBeingFirstResponder() { }
open func makeSceneKey() { window?.makeKey() }
}

// MARK: Create Popup Scene
Expand All @@ -65,10 +67,10 @@ extension PopupSceneDelegate {
.registerPopups(configBuilder: configBuilder)
)
hostingController.view.backgroundColor = .clear

window = Window(windowScene: windowScene)
window = Window(scene: self, windowScene: windowScene)
window?.rootViewController = hostingController
window?.isHidden = false
window?.makeKey()
}}
}

Expand All @@ -77,8 +79,21 @@ extension PopupSceneDelegate {



// MARK: Implementation

fileprivate class Window: UIWindow {
weak var scene: PopupSceneDelegate?

init(scene: PopupSceneDelegate, windowScene: UIWindowScene) {
super.init(windowScene: windowScene)
self.scene = scene
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

// MARK: Implementation
extension Window {
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
if #available(iOS 26, *) { point_iOS26(inside: point, with: event) }
else if #available(iOS 18, *) { point_iOS18(inside: point, with: event) }
Expand All @@ -89,6 +104,11 @@ fileprivate class Window: UIWindow {
else if #available(iOS 18, *) { hitTest_iOS18(point, with: event) }
else { hitTest_iOS17(point, with: event) }
}
override func resignKey() {
super.resignKey()

scene?.sceneStoppedBeingFirstResponder()
}
}

// MARK: Point
Expand Down