Daily iOS
SwiftUI

.task vs onAppear

In a SwiftUI view that loads data, what's the correct statement about how these two pieces of code behave differently?

// A
.onAppear { Task { await vm.load() } }
// B
.task { await vm.load() }

Pick one

Submit