Xcode Previews spawn multiple instances of my Mac app

I have a Mac app in Xcode using SwiftUI.

Recently I noticed the Xcode's previews had become very sluggish, and after some sleuthing I discovered that was because when the previews were running, it would spawn a new instance of the app in the background for every keystroke, and never quits any of these instances.

Here's a video where you can see the problem: https://static.squares.tv/Xcode%20Spawning%20720p.mov

It's a document-based app where I'm doing a lot of Metal rendering, using different audio and video frameworks and extensions with custom networking so it's possible something is blocking the app's ability to quit easily.

How do I troubleshoot this problem to figure out exactly what is preventing Xcode from operating cleanly here?

Hello,

Sorry to hear you are having performance problems while using previews. The best next step will be to file a feedback with diagnostics so we can take a look.

Steps to generate helpful diagnostics:

  1. Download and install the logging profile on all devices involved. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift
  2. Reproduce the issue
  3. Click the "Diagnostics" button in the error banner in Previews' Canvas area (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  4. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  5. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)
  6. Generate the sysdiagnose(s) and attach those too

Once filed, please reply with feedback number.

Xcode Previews spawn multiple instances of my Mac app
 
 
Q