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?