SwiftData with CloudKit freezing previews in Xcode 16 beta

To reproduce:

  1. In Xcode, create a new project with SwiftData storage
  2. Add a new item in the preview — everything works fine so far
  3. Enable CloudKit sync for the target (add iCloud capability, check CloudKit, add a container)
  4. Go back to the preview and add a new item — Xcode will now freeze

As soon as you modify the SwiftData storage, the preview freezes and the Xcode app becomes extremely slow until you either refresh the preview or restart Xcode.

SwiftData with CloudKit freezing previews in Xcode 16 beta
 
 
Q