krzysztofzablocki / Inject

Hot Reloading for Swift applications!
MIT License
2.1k stars 114 forks source link

Update ObserveInjection concurrency #98

Closed john-flanagan closed 1 month ago

john-flanagan commented 1 month ago

This allows for adding @ObserveInjection properties to Views that don't already have @MainActor isolated init methods without chaning that API contract.

This matches the annotations of ObservedObject in the iOS 18 SDK

johnno1962 commented 1 month ago

👍 👍 thanks! I was wondering as @preconcurency is not supported before the Swift6 compiler would it be better duplicating these definitions with and without dependant on the #if swift(>=6)?

john-flanagan commented 1 month ago

@johnno1962 I'm building it locally with Swift 5.9. I think this is the proposal that introduced it, which was implemented in Swift 5.6 https://github.com/swiftlang/swift-evolution/blob/main/proposals/0337-support-incremental-migration-to-concurrency-checking.md

johnno1962 commented 1 month ago

I guess that might be far enough back (Xcode 13.3) but it always seems a shame introducing a constraint when it can be avoided with a few extra lines. It's @krzysztofzablocki's call though. The direction of the PR is good.

jflan-dd commented 3 weeks ago

@krzysztofzablocki Could you cut a release with this PR to make it easier to consume in our app?