Skip to content
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

Package observation seems to collide with SwiftUI @Observable. #31

Open
cyrilzakka opened this issue Dec 28, 2024 · 1 comment
Open

Comments

@cyrilzakka
Copy link

cyrilzakka commented Dec 28, 2024

I think I'm going crazy here but after importing

import ModelsDSTU2
import ModelsR4

in a project it stops compiling with some obscure errors. From what I can make out, it seems the classes defined in the package clash with the SwiftUI @observable macro:

/var/folders/rt/5jrx9dk91r17__4r2tm3m01w0000gn/T/swift-generated-sources/@__swiftmacro_6cardya13HKDataManager10ObservablefMe_.swift:1:26 'Observation' is ambiguous for type lookup in this context

A minimal reproduction of this error:

import SwiftUI
import ModelsDSTU2
import ModelsR4

@Observable class TestClass {}

The quickest work around has been to move all associated code to a separate file in an extension.

@p2-apple
Copy link
Collaborator

Oh yes, that sounds like @Observable uses an Observation concrete type in the expansion, which of course is also a type in the FHIR libraries.

Your workaround seems sensible to me. Maybe the Swift team can also improve the Macro to better scope the expansion to their internal types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants