🚨 :: Fix keyWindow deprecation warning

This commit is contained in:
Felix Mau committed 2022-03-10 13:58:36 +01:00
1 parent be40ac8c35
commit 03b9fac539
4 files changed
+31 -27

No files matched your search

@@ -8,6 +8,8 @@
import SnapshotTesting
@testable import GradientLoadingBar
// MARK: - Config
private enum Config {
@@ -25,7 +27,7 @@ extension Snapshotting where Value: UIViewController, Format == UIImage {
Async<UIImage> { callback in
UIView.setAnimationsEnabled(false)
guard let keyWindow = UIApplication.shared.windows.first(where: { $0.isKeyWindow }) else {
guard let keyWindow = UIApplication.shared.keyWindowInConnectedScenes else {
fatalError("⚠️ – Failed to get key window from application!")
}
keyWindow.rootViewController = viewController