Task { @MainActor in ... } forces the code between the braces to run on the main actor. It also allows the code to run when the main actor is not otherwise busy doing something else. The code is not synchronous. createSampleData will create the task and immediately return.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: