ThimraTV/MoviaBox/Libs/Alert/SPAlertWindowManager.swift
2025-05-14 15:27:48 +08:00

45 lines
990 B
Swift

//
// SPAlertWindowManager.swift
// MoviaBox
//
// Created by on 2025/5/13.
//
import UIKit
class SPAlertWindowManager {
static let manager = SPAlertWindowManager()
private var window: UIWindow?
private var count = 0
func createWindow() -> UIWindow {
count += 1
guard let window = window else {
let window = UIWindow(windowScene: SPAPPTool.windowScene!)
window.backgroundColor = .clear
window.windowLevel = .alert
window.isHidden = false
self.window = window
return window
}
return window
}
func dismissWindow() {
// count -= 1
guard let window = self.window else { return }
if window.subviews.count <= 0 {
window.isHidden = true
self.window = nil
}
// if count == 0 {
// window?.isHidden = true
// window = nil
// }
}
}