Skip to content

feat: Swift6 annotations of thread safe existing code #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/InfomaniakDI/Factory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions Sources/InfomaniakDI/SimpleResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand Down
Loading