From 5f07515928782d646c77bcd577fa290764f5c511 Mon Sep 17 00:00:00 2001 From: Sergey Kazakov Date: Wed, 18 Sep 2024 01:49:56 +0100 Subject: [PATCH] minor refactoring --- .../DependencyInjection/DependencyContainer.swift | 10 +++------- .../Puredux/DependencyInjection/DependencyKey.swift | 3 --- .../Documentation.docc/Articles/DependencyInjection.md | 2 +- Tests/PureduxTests/InjectionTests/InjectionTests.swift | 1 + 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Sources/Puredux/DependencyInjection/DependencyContainer.swift b/Sources/Puredux/DependencyInjection/DependencyContainer.swift index 2194027..67f784a 100644 --- a/Sources/Puredux/DependencyInjection/DependencyContainer.swift +++ b/Sources/Puredux/DependencyInjection/DependencyContainer.swift @@ -8,12 +8,6 @@ import Foundation import Dispatch - - -extension DispatchQueue { - static let di = DispatchQueue(label: "com.puredux.dependencies", attributes: .concurrent) -} - public protocol DependencyContainer: Sendable { init() } @@ -43,4 +37,6 @@ extension DependencyContainer { } } - +fileprivate extension DispatchQueue { + static let di = DispatchQueue(label: "com.puredux.dependencies", attributes: .concurrent) +} diff --git a/Sources/Puredux/DependencyInjection/DependencyKey.swift b/Sources/Puredux/DependencyInjection/DependencyKey.swift index d672a6f..2af2f3f 100644 --- a/Sources/Puredux/DependencyInjection/DependencyKey.swift +++ b/Sources/Puredux/DependencyInjection/DependencyKey.swift @@ -28,7 +28,4 @@ public protocol DependencyKey { public protocol StoreInjectionKey: DependencyKey where Value: Store { /** The associated type representing the type of the dependency injection key's value. */ -// -// /** The default value for the dependency injection key. */ -// static var currentValue: Self.Value { get set } } diff --git a/Sources/Puredux/Documentation.docc/Articles/DependencyInjection.md b/Sources/Puredux/Documentation.docc/Articles/DependencyInjection.md index 8333a1b..13888e9 100644 --- a/Sources/Puredux/Documentation.docc/Articles/DependencyInjection.md +++ b/Sources/Puredux/Documentation.docc/Articles/DependencyInjection.md @@ -112,6 +112,6 @@ By implementing a clear separation of concerns between store injection and depen - Read-Only Access with `Dependency` and `StoreOf`: These mechanisms provide controlled, read-only access to the dependency injection containers. By restricting modification capabilities, they help maintain the integrity of the state and dependencies throughout the app, reducing the risk of unintended misuse -- Specialization of `StoreO`f: This property wrapper is specifically designed to support only `StateStore` types, which are responsible for owning the state. +- Specialization of `StoreOf`: This property wrapper is specifically designed to support only `StateStore` types, which are responsible for owning the state. `@StoreEntry` only supports values of `any Store` type. - Controlled Access with `Dependencies` and `SharedStores`: These tools offer read and write access to the dependency injection containers, but within a confined scope of the application. This limitation ensures that modifications to dependencies and stores are kept localized, reducing the risk of unintended changes. diff --git a/Tests/PureduxTests/InjectionTests/InjectionTests.swift b/Tests/PureduxTests/InjectionTests/InjectionTests.swift index fe50645..de5c77c 100644 --- a/Tests/PureduxTests/InjectionTests/InjectionTests.swift +++ b/Tests/PureduxTests/InjectionTests/InjectionTests.swift @@ -11,6 +11,7 @@ import XCTest extension SharedStores { @StoreEntry var theStore = StateStore(1) { _,_ in } + } extension Injected {