General topic questions
MainActor
MediumLess common
Free section · general topics & algorithms
Why annotate UI updates with @MainActor? What happens if you don’t?
Reveal model answer
UIKit/SwiftUI require main-thread UI access. @MainActor enforces that at compile time with isolation. Skipping it risks crashes/races; use Task { @MainActor in } or MainActor.run for hops.