I don't know whether it matters, but the view is updated via a .task() modifier like follows:
struct ContentView: View {
var model: Model
@State var pdf: PDFDocument?
var body: some View {
HStack {
SheetView(pdf: pdf)
ModelView(model: $model)
.task(id: model) {
pdf = await createPdf(from: model)
}
}
}
}
func createPdf(from model: Model) async -> PDFDocument? {
...
}
where ModelView contains some controls for changing the model which triggers the task() modifier which creates a new PDFDocument and assigns it to the @State var pdf.
All that works nicely with the only caveat that the update of the PDFView within the SheetView flashes.
Thanks for any help!
-Thorsten