[Closes #265] Injection of viewmodel when @Observable not working properly #266
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new property wrapper
InjectedObservable
to manage observable dependencies in SwiftUI views and includes tests to verify its functionality. The most important changes include the addition of theInjectedObservable
property wrapper, updates to the test suite, and the creation of a new observable view model.New Property Wrapper for Dependency Injection:
Sources/Factory/Factory/Injections.swift
: Introduced theInjectedObservable
property wrapper, which resolves and injects observable dependencies from a shared container into SwiftUI views. This wrapper supports iOS 17.0, macOS 14.0, tvOS 17.0, and watchOS 10.0.Test Suite Enhancements:
Tests/FactoryTests/FactoryInjectionTests.swift
: Added a new test casetestInjectedObservable
to verify the functionality of theInjectedObservable
property wrapper, including initialization from both default and custom containers, as well as direct parameter passing.New Observable View Model:
Tests/FactoryTests/FactoryInjectionTests.swift
: Created theContentObservableViewModel
class conforming to theObservable
protocol and added it to both the defaultContainer
and a custom container for dependency resolution.