XCode 15.3 WidgetKit Preview Problem

Hi all,

I am trying to create a widget for my app but I cannot use the Preview feature of Xcode. Xcode enters a build loop and builds the project over and over. There is no error or message. There is only a loading spinner and lots of build. It doesn't matter how much time I wait, it never finishes.

I tried to clean the build folder, delete all preview simulators, quit, and reopen the XCode but nothing helped.

Are you using external dependencies like pods, or swift packages that might not have all downloaded? Start with cleaning up all of the warnings as it is reckless to have warnings that eventually turn into errors.

Hi,

Sorry to hear you are having problems getting previews working. Does this issue only reproduce when trying to preview the widget, or also when previewing anything in your main app too?

Either way 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 report (will be named something like previews-diagnostics-0123456789.zip)
  6. Generate the sysdiagnose(s) and attach those too

Have you had any luck figuring out what's causing this or how to avoid? It has been happening to me too. I try restarting Xcode but it keeps building over and over again. Eventually, randomly, it will complete, but it's such a huge waste of time waiting for it to stop!

I looked at the instructions for submitting diagnostics but got stuck because I don't know how to download and install the logging profile when for the preview canvas, and the problem doesn't apply to using a real device. In fact, does it even make sense to capture diagnostics for the device if the problem is with Xcode?

XCode 15.3 WidgetKit Preview Problem
 
 
Q