ConcurrencyContinuationReproduce

Differences of Concurrency behaviors between Xcode 14.0 and 14.1

On Xcode 14.1

withCheckedContinuation‘s body will run on background thread in case of starting from main-actor.

This situation happens only earlier than iOS 15. so 13.x and 14.x have this situation with Xcode 14.1. Those OS versions are targets of back-deployments of Concurrency.

Task { @MainActor () -> Void in
  await withCheckedContinuation { c in    
    // >= iOS 15 : on main-thread
    // < iOS 15 : on background-thread
    c.resume()
  }
}

image

Until Xcode 14.0(also 14.0.1) is fine.

Related

https://twitter.com/kylehickinson/status/1582471814843883535

GitHub

View Github