Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setup parameter for Application #99

Merged
merged 2 commits into from
Mar 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading