Skip to content

Instantly share code, notes, and snippets.

@SebastianBoldt
Created February 4, 2022 14:31

Revisions

  1. SebastianBoldt created this gist Feb 4, 2022.
    10 changes: 10 additions & 0 deletions MainActorRun.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    func loadData() async -> Data {
    return Data()
    }

    func refreshUI(with data: Data) async {
    let data = await loadData()
    await MainActor.run {
    view.update(with: data)
    }
    }