Using async from SwiftUI

In "Meet async/await in Swift", around 23.38, we see that we in SwiftUI can do a

.onAppear { 
  async {
    self.image = try? await self.viewModel.fetchThumbnail(for: post.id) 
  } 
}

However, we also hear in this session that an async function can be called on one thread and resumed on another. In the code above, we update UI state, and thus self.image must be updated on the main thread. What on this slide ensures that it is actually returned to the main thread?

if viewModel is marked with MainActor, i think we can do it

Using async from SwiftUI
 
 
Q