I have data that needs to be requested from backend and then presented as graph.
Im trying to use new async+await and wonder what is the best patter/practice would be.
var body: some View {
VStack {
ZStack {
AreaGraphView( dataPoints: modelData.todayTimeline())
}
}
}
ModelData snippet
@Observable final class ModelData {
// ...
func todayTimeline() async -> [DataPoint] {
// some async work
}
// ....
}
One of options I consider do call to modelData.todayTimeline() in onAppear. It would mean I need to pass dummy or empty data to AreaGraphView.
Any other options?