hmlongco / Factory

A new approach to Container-Based Dependency Injection for Swift and SwiftUI.
MIT License
1.93k stars 116 forks source link

2.4.2 version does not build in Swift 5 mode #250

Closed balazserdeszlogmein closed 5 days ago

balazserdeszlogmein commented 6 days ago

Hi, I added the package to a very basic project, created with Xcode 15.4, supporting macOS 13.0 or later. Zero references have been added to Factory in the project, and still, 2.4.2 release build fails:

Screenshot 2024-11-26 at 4 23 51 PM

Factory/Factory/Containers.swift:

/// Defines the default factory helpers for containers
extension ManagedContainer {
    /// Syntactic sugar allows container to create a properly bound Factory.
    @inlinable @inline(__always) public func callAsFunction<T>(
        key: StaticString = #function,
        _ factory: @escaping @Sendable @isolated(any) () -> T // error here: Attribute can only be applied to declarations, not types
    ) -> Factory<T> {
        Factory(self, key: key, factory)
    }

    [...]
}

I thought Factory supported Swift 5, based on its Package.swift. 2.4.1 builds without any issue.

hmlongco commented 6 days ago

See 2.4.3

balazserdeszlogmein commented 5 days ago

Thank you, the build is now successful.