From 8f433e04af9fd24dde7ead08e6287adbdd3e6828 Mon Sep 17 00:00:00 2001 From: Leif Date: Sun, 10 Mar 2024 10:34:27 -0600 Subject: [PATCH 1/2] Add setup parameter for Application --- Sources/AppState/Application/Application.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/AppState/Application/Application.swift b/Sources/AppState/Application/Application.swift index cf77fe6..b96444b 100644 --- a/Sources/AppState/Application/Application.swift +++ b/Sources/AppState/Application/Application.swift @@ -32,13 +32,16 @@ open class Application: NSObject { deinit { bag.removeAll() } #endif - /// Default init used as the default Application, but also any custom implementation of Application. You should never call this function, but instead should use `Application.promote(to: CustomApplication.self)` - public override required init() { + /// Default init used as the default Application, but also any custom implementation of Application. You should never call this function, but instead should use `Application.promote(to: CustomApplication.self)`. + public required init( + setup: (Application) -> Void = { _ in } + ) { lock = NSRecursiveLock() cache = Cache() super.init() + setup(self) loadDefaultDependencies() #if !os(Linux) && !os(Windows) From f29c4373382d5e762b666c104aa4bc18e0d40913 Mon Sep 17 00:00:00 2001 From: Leif Date: Sun, 10 Mar 2024 10:39:22 -0600 Subject: [PATCH 2/2] Change windows and linux logger to a var --- Sources/AppState/Application/Application.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/AppState/Application/Application.swift b/Sources/AppState/Application/Application.swift index b96444b..dd28a91 100644 --- a/Sources/AppState/Application/Application.swift +++ b/Sources/AppState/Application/Application.swift @@ -16,7 +16,7 @@ open class Application: NSObject { public static let logger: Logger = Logger(subsystem: "AppState", category: "Application") #else /// Logger specifically for AppState - public static let logger: ApplicationLogger = ApplicationLogger() + public static var logger: ApplicationLogger = ApplicationLogger() #endif static var isLoggingEnabled: Bool = false