body

some

View

Text

viewModel

result

rawValue

??

"Loading"

onAppear

viewModel

load

()

More recently, Swift introduced actors to support 
synchronization for shared, mutable state. 
To ensure that work is performed on the main thread,
define a view model class that is marked as a @MainActor, 
with a load() function that internally calls an 
asynchronous function using Task.

@MainActor

class

ContentViewModel

ObservableObject

@Published

private(set)

var

result

Weather

func

load

()

async

try