From 8263a3eb4dfc21596181e153ff1a0395f7e31c84 Mon Sep 17 00:00:00 2001 From: Basem Emara Date: Fri, 25 Oct 2019 00:11:46 -0400 Subject: [PATCH] Load application plugin early --- .../Application/ApplicationPluggableDelegate.swift | 7 +++++++ .../Application/ExtensionPluggableDelegate.swift | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Sources/ZamzamCore/Application/ApplicationPluggableDelegate.swift b/Sources/ZamzamCore/Application/ApplicationPluggableDelegate.swift index 88d8ba89..2adbf6ef 100644 --- a/Sources/ZamzamCore/Application/ApplicationPluggableDelegate.swift +++ b/Sources/ZamzamCore/Application/ApplicationPluggableDelegate.swift @@ -52,6 +52,13 @@ open class ApplicationPluggableDelegate: UIResponder, UIApplicationDelegate { /// List of application plugins for binding to `AppDelegate` events public private(set) lazy var plugins: [ApplicationPlugin] = { application() }() + public override init() { + super.init() + + // Load lazy property early + _ = plugins + } + /// List of application plugins for binding to `AppDelegate` events open func application() -> [ApplicationPlugin] {[]} // Override } diff --git a/Sources/ZamzamCore/Application/ExtensionPluggableDelegate.swift b/Sources/ZamzamCore/Application/ExtensionPluggableDelegate.swift index a2b6530c..506efd95 100644 --- a/Sources/ZamzamCore/Application/ExtensionPluggableDelegate.swift +++ b/Sources/ZamzamCore/Application/ExtensionPluggableDelegate.swift @@ -51,6 +51,13 @@ open class ExtensionPluggableDelegate: NSObject, WKExtensionDelegate { /// List of application plugins for binding to `ExtensionDelegate` events public private(set) lazy var plugins: [ExtensionPlugin] = { application() }() + public override init() { + super.init() + + // Load lazy property early + _ = plugins + } + /// List of application plugins for binding to `ExtensionDelegate` events open func application() -> [ExtensionPlugin] {[]} // Override }