From 53ea9145208c87411d5624805bc97d8bc6f29914 Mon Sep 17 00:00:00 2001 From: Ivan Smetanin Date: Sat, 2 Sep 2017 13:28:35 +0300 Subject: [PATCH] Added public property window to ApplicationService extension --- .../Classes/ApplicationServicesManager.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PluggableApplicationDelegate/Classes/ApplicationServicesManager.swift b/PluggableApplicationDelegate/Classes/ApplicationServicesManager.swift index 270fd0c..367045e 100644 --- a/PluggableApplicationDelegate/Classes/ApplicationServicesManager.swift +++ b/PluggableApplicationDelegate/Classes/ApplicationServicesManager.swift @@ -13,6 +13,16 @@ import CloudKit /// It doesn't add more functionalities yet. public protocol ApplicationService: UIApplicationDelegate {} +extension ApplicationService { + @nonobjc public var window: UIWindow? { + get { + return UIApplication.shared.delegate?.window ?? nil + } set(newValue) { + (UIApplication.shared.delegate as? PluggableApplicationDelegate)?.window = newValue + } + } +} + open class PluggableApplicationDelegate: UIResponder, UIApplicationDelegate { public var window: UIWindow?