I was wondering if anyone knows why the sample project uses Task.detached
everywhere because it seems highly non-standard, e.g. in ContentView
:
.task {
Task.detached { @MainActor in
await flightData.load()
}
}
Instead, I would expect to see something like:
.task {
flightData = await controller.loadFlightData()
}
Or:
.task {
await controller.load(flightData: flightData)
}
Is the use of detached
perhaps an attempt to work around some issue with ObservableObject
published updates?