From 507424ae43eed80baabf4df3022be2ab061bef41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Copin?= Date: Mon, 15 May 2017 14:54:57 +0100 Subject: [PATCH] Set window property on ApplicationService if defined --- .../Classes/ApplicationServicesManager.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PluggableApplicationDelegate/Classes/ApplicationServicesManager.swift b/PluggableApplicationDelegate/Classes/ApplicationServicesManager.swift index bc24e8d..934c6dc 100644 --- a/PluggableApplicationDelegate/Classes/ApplicationServicesManager.swift +++ b/PluggableApplicationDelegate/Classes/ApplicationServicesManager.swift @@ -19,7 +19,13 @@ open class PluggableApplicationDelegate: UIResponder, UIApplicationDelegate { open var services: [ApplicationService] { return [] } private lazy var __services: [ApplicationService] = { - return self.services + let services = self.services + for service in (services as! [NSObject]) { + if service.responds(to: #selector(setter: UIApplicationDelegate.window)) { + service.perform(#selector(setter: UIApplicationDelegate.window), with: self.window) + } + } + return services }() @available(iOS 2.0, *)