Problems with Observable Macro and Observation: Observable is not member type of class 'Models.Observation'

Hey there i try to adept the Observable macro for my SwiftUI Project. I wanna get data from HealthKit and transform it to FHIR. Here i need one class for managing this process which will be shared through my project in order to access these data.

The following Codesnippet raises an error:

import Observation
import HealthKit
import FHIR

@Observable
class HealthKitManager{
    let healthStore = HKHealthStore()
    
    init(){
        
    }
    
    func requestAuthorization(){
        let authTypes: Set = [HKQuantityType(.stepCount),
                              HKQuantityType(.heartRate)
        ]
        
        guard HKHealthStore.isHealthDataAvailable() else {
            print("health data not available!")
            return
        }
        
        healthStore.requestAuthorization(toShare: nil, read: authTypes) {
            success, error in
            if success {
                print("OK Fetching")
            } else {
                print("\(String(describing: error))")
            }
        }   
    }
}

So the FHIR module contains a Models module which define different models. In the FHIR world there is also a concept called observation... now the problems begin.

open class Observation : Models.DomainResource {
    ...
}

When i try import Observation for the Observable macro and also import FHIR in order to create Observations, XCode rises an error: Observable' is not a member type of class 'Models.Observation'

It's also said that Observation is declared in the FHIR.Models.Observation class which is true, but it seems that this raises the Problem with the @Observable macro.

It's also said that Type 'Observation' has no member 'ObservationRegistrar'

Which comes from the Observable Macro i think.

When i don't import FHIR then everything works fine, but then my use case is broken because i need these standard in order to get my use case running.

All in all i need big help and be thankfull for possible solutions!

One possible fix could be to extract fhir interaction in another class which is not annotated with Observable macro und simply use the new class.

Problems with Observable Macro and Observation: Observable is not member type of class 'Models.Observation'
 
 
Q