Remove old DI files from LuminateCore, add import LuminateDI to consumers

This commit is contained in:
Brendan Szymanski 2026-06-14 16:22:24 -04:00
parent b12352c29d
commit 0ecb95d7c8
6 changed files with 3 additions and 62 deletions

View file

@ -1,6 +1,7 @@
import Adwaita
import Foundation
import LuminateCore
import LuminateDI
import LuminateHome
import LuminateLibrary
import LuminatePlayer

View file

@ -1,33 +0,0 @@
import Foundation
public final class DIContainer {
public static let shared = DIContainer()
public private(set) var values = InjectionValues()
private init() {}
public func register<T>(
_ keyPath: WritableKeyPath<InjectionValues, T?>,
value: T
) {
values[keyPath: keyPath] = value
}
public func resolve<T>(
_ keyPath: KeyPath<InjectionValues, T?>
) -> T {
guard let value = values[keyPath: keyPath] else {
fatalError(
"DIContainer: No value registered for \(keyPath). "
+ "Call DIContainer.shared.register(\\.key, value:) during app startup."
)
}
return value
}
public func reset() {
values = InjectionValues()
}
}

View file

@ -1,16 +0,0 @@
import Foundation
@propertyWrapper
public struct Injected<T> {
private let keyPath: KeyPath<InjectionValues, T?>
public var wrappedValue: T {
DIContainer.shared.resolve(keyPath)
}
public init(_ keyPath: KeyPath<InjectionValues, T?>) {
self.keyPath = keyPath
}
}

View file

@ -1,13 +0,0 @@
import Foundation
public struct InjectionValues {
public var client: JellyfinClient?
public var userId: String?
public var imageService: ImageService?
public var webSocketClient: WebSocketClient?
public var persistence: PersistenceService?
public init() {}
}

View file

@ -1,6 +1,7 @@
import Adwaita
import Foundation
import LuminateCore
import LuminateDI
struct HomePosterCell: View {

View file

@ -1,5 +1,6 @@
import Adwaita
import LuminateCore
import LuminateDI
public struct HomeView: View {