2023-02-27 05:39:07 +00:00
|
|
|
import Combine
|
2023-01-23 17:43:48 +00:00
|
|
|
import UIKit
|
|
|
|
|
2023-09-18 05:01:23 +00:00
|
|
|
@Observable public class SceneDelegate: NSObject, UIWindowSceneDelegate {
|
2023-01-23 17:43:48 +00:00
|
|
|
public var window: UIWindow?
|
2023-01-25 12:02:28 +00:00
|
|
|
|
2023-01-23 17:43:48 +00:00
|
|
|
public var windowWidth: CGFloat {
|
|
|
|
window?.bounds.size.width ?? UIScreen.main.bounds.size.width
|
|
|
|
}
|
2023-01-25 12:02:28 +00:00
|
|
|
|
2023-01-23 17:43:48 +00:00
|
|
|
public func scene(_ scene: UIScene,
|
2023-01-25 12:02:28 +00:00
|
|
|
willConnectTo _: UISceneSession,
|
|
|
|
options _: UIScene.ConnectionOptions)
|
|
|
|
{
|
2023-01-23 17:43:48 +00:00
|
|
|
guard let windowScene = scene as? UIWindowScene else { return }
|
2023-01-25 12:02:28 +00:00
|
|
|
window = windowScene.keyWindow
|
2023-10-23 17:12:25 +00:00
|
|
|
|
|
|
|
#if targetEnvironment(macCatalyst)
|
|
|
|
if let titlebar = windowScene.titlebar {
|
|
|
|
titlebar.titleVisibility = .hidden
|
|
|
|
titlebar.toolbar = nil
|
|
|
|
}
|
|
|
|
#endif
|
2023-01-23 17:43:48 +00:00
|
|
|
}
|
|
|
|
}
|