Skip to content

Commit 562bcbb

Browse files
committed
refactor: DIContainer의 싱글턴 패턴을 default로 수정하고 unchecked Sendable 처리
1 parent a4dd36b commit 562bcbb

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

Application/DevLogApp/Sources/App/Delegate/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import DevLogInfra
1212

1313
class AppDelegate: UIResponder, UIApplicationDelegate {
1414
private let logger = Logger(category: "AppDelegate")
15-
private let container = AppDIContainer.shared
15+
private let container = AppDIContainer.default
1616

1717
func application(
1818
_ app: UIApplication,

Application/DevLogApp/Sources/App/DevLogApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct DevLogApp: App {
1919
@State private var windowEvent = TodoEditorWindowEvent()
2020

2121
init() {
22-
AppAssembler().assemble(AppDIContainer.shared)
22+
AppAssembler().assemble(AppDIContainer.default)
2323
}
2424

2525
var body: some Scene {

Application/DevLogCore/Sources/DIContainer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public enum DependencyScope {
2424
case transient
2525
}
2626

27-
public protocol DIContainer {
27+
public protocol DIContainer: Sendable {
2828
func register<T>(
2929
_ type: T.Type,
3030
name: DependencyName?,
@@ -50,8 +50,8 @@ public extension DIContainer {
5050
}
5151
}
5252

53-
public final class AppDIContainer: DIContainer {
54-
public static let shared = AppDIContainer()
53+
public final class AppDIContainer: DIContainer, @unchecked Sendable {
54+
public static let `default` = AppDIContainer()
5555

5656
private let lock = NSRecursiveLock()
5757

Application/DevLogCore/Sources/DIContainerKey.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import SwiftUI
99

1010
private struct DIContainerKey: EnvironmentKey {
11-
static let defaultValue: any DIContainer = AppDIContainer.shared
11+
static let defaultValue: any DIContainer = AppDIContainer.default
1212
}
1313

1414
public extension EnvironmentValues {

0 commit comments

Comments
 (0)