I have class conforms to ObservableObject with
@Published var fileContent = ""
defined. Further I have getFileContent() async function returning String. If I call function like this
Task {
fileContent = await getFileContent(forMeasurementID: id, inContext: context)
}
code is compiled and app works fine but XCode is complaining "purple" error "Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.". I've tried to elaborate with receive(on:) but no succeess so far. I will appreciate any hint. Thanks.