Skip to content

Commit

Permalink
Add setup parameter for Application (#99)
Browse files Browse the repository at this point in the history
* Add setup parameter for Application

* Change windows and linux logger to a var
  • Loading branch information
0xLeif authored Mar 10, 2024
1 parent fbffe58 commit 6d47c27
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/AppState/Application/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 6d47c27

Please sign in to comment.