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
.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
SwiftUIShort answerBasics
SwiftUI views have no viewDidLoad or viewWillAppear like UIKit. How does a view actually …
#task #onappear #lifecycle
UIKitShort answerBasics
A teammate kicks off a network request directly in viewDidLoad and updates the UI when th…
#task #cancellation #lifecycle
ConcurrencyShort answerBasics
In Swift Concurrency, when you create a Task { }, when and where does that code run?
#task #cancellation
ConcurrencyMultiple choiceExpert
In this Swift Concurrency code, which statement about what actually happens right after t…
#task #cancellation