StanfordSpezi / Spezi

Open-source framework for rapid development of modern, interoperable digital health applications.
https://swiftpackageindex.com/StanfordSpezi/Spezi/documentation
MIT License
145 stars 11 forks source link

Automatically Inject `ObservableObject` Instances #79

Closed PSchmiedmayer closed 11 months ago

PSchmiedmayer commented 1 year ago

Problem

We currently only inject objects in the SwiftUI environment that conform to ObservableObjectProvider. Unfortunately, this is sometimes unintuitive when developers just want to create a simple component that conforms to ObservableObject and should be injected in the SwiftUI environment, and developers do not need or are not aware of the ObservableObjectProvider protocol.

Solution

We should also check for instances conforming to ObservableObject and inject them into the SwiftUI environment.

Code of Conduct