diff --git a/Sources/InfomaniakDI/Factory.swift b/Sources/InfomaniakDI/Factory.swift index ffa1cdd..3b69f00 100644 --- a/Sources/InfomaniakDI/Factory.swift +++ b/Sources/InfomaniakDI/Factory.swift @@ -17,7 +17,7 @@ import Foundation public typealias FactoryClosure = (_ parameters: [String: Any]?, _ resolver: SimpleResolvable) throws -> Any /// Something that can build a type -public protocol Factoryable { +public protocol Factoryable: Sendable { /// Required init for a Factoryable /// - Parameters: /// - type: The type we register, prefer using a Protocol here. Great for testing. @@ -35,7 +35,7 @@ public protocol Factoryable { var type: Any.Type { get } } -public struct Factory: Factoryable, CustomDebugStringConvertible { +public struct Factory: Factoryable, CustomDebugStringConvertible, @unchecked Sendable { /// The factory closure private let closure: FactoryClosure diff --git a/Sources/InfomaniakDI/SimpleResolver.swift b/Sources/InfomaniakDI/SimpleResolver.swift index 2614f8a..5e30a2f 100644 --- a/Sources/InfomaniakDI/SimpleResolver.swift +++ b/Sources/InfomaniakDI/SimpleResolver.swift @@ -18,7 +18,7 @@ import Foundation /// Something minimalist that can resolve a concrete type /// /// Servicies are kept alive for the duration of the app's life -public protocol SimpleResolvable { +public protocol SimpleResolvable: Sendable { /// The main solver funtion, tries to fetch an existing object or apply a factory if availlable /// - Parameters: /// - type: the wanted type @@ -34,7 +34,7 @@ public protocol SimpleResolvable { } /// Something that stores a factory for a given type -public protocol SimpleStorable { +public protocol SimpleStorable: Sendable { /// Store a factory closure for a given type /// /// You will virtualy never call this directly @@ -48,7 +48,7 @@ public protocol SimpleStorable { /// A minimalist DI solution /// Once initiated, stores types as long as the app lives -public final class SimpleResolver: SimpleResolvable, SimpleStorable, CustomDebugStringConvertible { +public final class SimpleResolver: SimpleResolvable, SimpleStorable, CustomDebugStringConvertible, @unchecked Sendable { public var debugDescription: String { var buffer: String! queue.sync {