diff --git a/Source/Alert/AlertConfig.swift b/Source/Alert/AlertConfig.swift index efc3f6c..245c5d2 100644 --- a/Source/Alert/AlertConfig.swift +++ b/Source/Alert/AlertConfig.swift @@ -8,7 +8,6 @@ import UIKit import SnapKit -import Inspire public extension UIWindow.Level { static let proAlert = UIWindow.Level.alert - 1 diff --git a/Source/Guard/GuardConfig.swift b/Source/Guard/GuardConfig.swift index da5d237..b8566fa 100644 --- a/Source/Guard/GuardConfig.swift +++ b/Source/Guard/GuardConfig.swift @@ -8,7 +8,6 @@ import UIKit import SnapKit -import Inspire public extension ProHUD.Configuration { struct Guard { @@ -106,7 +105,7 @@ fileprivate var privReloadData: (ProHUD.Guard) -> Void = { if width < config.cardMaxWidth { mk.bottom.equalToSuperview() } else { - mk.bottom.equalToSuperview().offset(-Inspire.shared.screen.safeAreaInsets.bottom) + mk.bottom.equalToSuperview().offset(-ProHUD.safeAreaInsets.bottom) } } else if UIDevice.current.userInterfaceIdiom == .pad { mk.centerY.equalToSuperview() @@ -116,13 +115,13 @@ fileprivate var privReloadData: (ProHUD.Guard) -> Void = { // stack vc.contentStack.snp.makeConstraints { (mk) in if isPortrait && vc.isFullScreen { - mk.top.equalToSuperview().offset(Inspire.shared.screen.safeAreaInsets.top) + mk.top.equalToSuperview().offset(ProHUD.safeAreaInsets.top) } else { mk.top.equalToSuperview().offset(config.padding) } mk.centerX.equalToSuperview() if width < config.cardMaxWidth { - let bottom = Inspire.shared.screen.safeAreaInsets.bottom + let bottom = ProHUD.safeAreaInsets.bottom if bottom == 0 { mk.bottom.equalToSuperview().offset(-config.padding) } else { diff --git a/Source/Guard/GuardController.swift b/Source/Guard/GuardController.swift index 98ed95a..a908312 100644 --- a/Source/Guard/GuardController.swift +++ b/Source/Guard/GuardController.swift @@ -8,7 +8,6 @@ import UIKit import SnapKit -import Inspire public typealias Guard = ProHUD.Guard diff --git a/Source/HUDConfig.swift b/Source/HUDConfig.swift index 7554b74..83fddd7 100644 --- a/Source/HUDConfig.swift +++ b/Source/HUDConfig.swift @@ -8,10 +8,8 @@ import UIKit -@available(iOS 13.0, *) - -fileprivate var sharedWindowScene: UIWindowScene? +/// HUD配置 public extension ProHUD { struct Configuration { @@ -21,14 +19,18 @@ public extension ProHUD { /// 根控制器,默认可以自动获取,如果获取失败请主动设置 public var rootViewController: UIViewController? - @available(iOS 13.0, *) /// iOS13必须设置此值,默认可以自动获取,如果获取失败请主动设置 + @available(iOS 13.0, *) + private static var sharedWindowScene: UIWindowScene? + + /// iOS13必须设置此值,默认可以自动获取,如果获取失败请主动设置 + @available(iOS 13.0, *) public var windowScene: UIWindowScene? { set { - sharedWindowScene = newValue + Configuration.sharedWindowScene = newValue } get { - return sharedWindowScene + return Configuration.sharedWindowScene } } diff --git a/Source/HUDView.swift b/Source/HUDView.swift index e202501..0044f7c 100644 --- a/Source/HUDView.swift +++ b/Source/HUDView.swift @@ -7,6 +7,7 @@ // import UIKit +import Inspire public extension ProHUD { @@ -173,3 +174,9 @@ extension CALayer { removeAnimation(forKey: .rotateKey) } } + +extension ProHUD { + static var safeAreaInsets: UIEdgeInsets { + return Inspire.shared.screen.updatedSafeAreaInsets + } +} diff --git a/Source/Toast/ToastController.swift b/Source/Toast/ToastController.swift index ceeb552..705db96 100644 --- a/Source/Toast/ToastController.swift +++ b/Source/Toast/ToastController.swift @@ -7,7 +7,6 @@ // import UIKit -import Inspire public typealias Toast = ProHUD.Toast @@ -316,7 +315,7 @@ fileprivate extension Toast { class func privUpdateToastsLayout() { func f() { - let top = Inspire.shared.screen.updatedSafeAreaInsets.top + let top = ProHUD.safeAreaInsets.top for (i, e) in toasts.enumerated() { let config = cfg.toast if let window = e.window {