Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
KazaiMazai committed Sep 18, 2024
1 parent cd61d9f commit 5f07515
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
10 changes: 3 additions & 7 deletions Sources/Puredux/DependencyInjection/DependencyContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -43,4 +37,6 @@ extension DependencyContainer {
}
}


fileprivate extension DispatchQueue {
static let di = DispatchQueue(label: "com.puredux.dependencies", attributes: .concurrent)
}
3 changes: 0 additions & 3 deletions Sources/Puredux/DependencyInjection/DependencyKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 1 addition & 0 deletions Tests/PureduxTests/InjectionTests/InjectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import XCTest

extension SharedStores {
@StoreEntry var theStore = StateStore<Int, Int>(1) { _,_ in }

}

extension Injected {
Expand Down

0 comments on commit 5f07515

Please sign in to comment.