From e627a2b4d103734cf76091779033aa7a1354805e Mon Sep 17 00:00:00 2001 From: Rudi Farkas Date: Tue, 18 Jul 2023 21:36:36 +0200 Subject: [PATCH] update iProgressHUDDemo - remove warnings re deprecated keyWindow; bump version to 1.2.0 --- iProgressHUDDemo/Podfile | 2 +- .../iProgressHUD/iProgressHUD-Info.plist | 40 +++++++++---------- .../NVActivityIndicatorPresenter.swift | 13 ++++-- .../iProgressHUD/iProgressHUDGlobal.swift | 17 -------- 4 files changed, 31 insertions(+), 41 deletions(-) diff --git a/iProgressHUDDemo/Podfile b/iProgressHUDDemo/Podfile index e240bde..707c21c 100644 --- a/iProgressHUDDemo/Podfile +++ b/iProgressHUDDemo/Podfile @@ -2,5 +2,5 @@ use_frameworks! platform :ios, '12.0' target 'iProgressHUDDemo' do - pod 'iProgressHUD', '~> 1.1.1' + pod 'iProgressHUD', '~> 1.2.0' end diff --git a/iProgressHUDDemo/Pods/Target Support Files/iProgressHUD/iProgressHUD-Info.plist b/iProgressHUDDemo/Pods/Target Support Files/iProgressHUD/iProgressHUD-Info.plist index d60f138..955b733 100644 --- a/iProgressHUDDemo/Pods/Target Support Files/iProgressHUD/iProgressHUD-Info.plist +++ b/iProgressHUDDemo/Pods/Target Support Files/iProgressHUD/iProgressHUD-Info.plist @@ -2,25 +2,25 @@ - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.1.1 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.2.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + diff --git a/iProgressHUDDemo/Pods/iProgressHUD/iProgressHUD/iProgressHUD/NVActivityIndicatorView/Presenter/NVActivityIndicatorPresenter.swift b/iProgressHUDDemo/Pods/iProgressHUD/iProgressHUD/iProgressHUD/NVActivityIndicatorView/Presenter/NVActivityIndicatorPresenter.swift index 4d3722e..67de12b 100755 --- a/iProgressHUDDemo/Pods/iProgressHUD/iProgressHUD/iProgressHUD/NVActivityIndicatorView/Presenter/NVActivityIndicatorPresenter.swift +++ b/iProgressHUDDemo/Pods/iProgressHUD/iProgressHUD/iProgressHUD/NVActivityIndicatorView/Presenter/NVActivityIndicatorPresenter.swift @@ -224,7 +224,7 @@ public final class NVActivityIndicatorPresenter { containerView.addConstraint(spacingConstraint) }()) - guard let keyWindow = UIApplication.shared.keyWindow else { return } + guard let keyWindow = getKeyWindow() else { return } keyWindow.addSubview(containerView) state = .showed @@ -255,12 +255,19 @@ public final class NVActivityIndicatorPresenter { } private func hide() { - guard let keyWindow = UIApplication.shared.keyWindow else { return } - + guard let keyWindow = getKeyWindow() else { return } for item in keyWindow.subviews where item.restorationIdentifier == restorationIdentifier { item.removeFromSuperview() } state = .hidden } + + func getKeyWindow() -> UIWindow? { + return UIApplication.shared.connectedScenes + .filter({$0.activationState == .foregroundActive}) + .compactMap({$0 as? UIWindowScene}) + .first?.windows + .filter({$0.isKeyWindow}).first + } } diff --git a/iProgressHUDDemo/Pods/iProgressHUD/iProgressHUD/iProgressHUD/iProgressHUDGlobal.swift b/iProgressHUDDemo/Pods/iProgressHUD/iProgressHUD/iProgressHUD/iProgressHUDGlobal.swift index 2e7179a..62fbd6b 100644 --- a/iProgressHUDDemo/Pods/iProgressHUD/iProgressHUD/iProgressHUD/iProgressHUDGlobal.swift +++ b/iProgressHUDDemo/Pods/iProgressHUD/iProgressHUD/iProgressHUD/iProgressHUDGlobal.swift @@ -9,23 +9,6 @@ import Foundation import UIKit -internal extension UIApplication { - class func topViewController(base: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? { - if let nav = base as? UINavigationController { - return topViewController(base: nav.visibleViewController) - } - if let tab = base as? UITabBarController { - if let selected = tab.selectedViewController { - return topViewController(base: selected) - } - } - if let presented = base?.presentedViewController { - return topViewController(base: presented) - } - return base - } -} - public extension UIView { private struct AssociatedKeys {