SwiftUI Previews Not Working

Hello all,

Recently, I. have been having issues with SwiftUI framework to view live previews in canvas sections. I'm seeking proper guidance.

Thank you, Arad Radfar

Replies

You do not give enough useful information.

Please explain what type of issue(s) you face. Also tell which versions of Xcode, MacOS… you use.

And possibly show complete code to try to reproduce error.

Hi aradradfar,

You wrote:

Recently, I. have been having issues with SwiftUI framework to view live previews in canvas sections. I'm seeking proper guidance.

Based on your post, I need more information about your SwiftUI app when rendering Xcode Previews or on-device previews. Specifically, I’ll need the diagnostics Swift Previews generates to make sure I understand the error encountered by the preview system. Please create a report in Feedback Assistant to share the details requested in the instructions below.

For issues with macOS, Mac Catalyst, or on-device iOS previews, perform the following steps to gather diagnostics:

  1. Download and install the Swift Previews logging profile for your device.
  2. Reproduce the error while previewing on device, taking note of the timestamp when the error occurred.
  3. Attach the Xcode sysdiagnose, sysdiagnose, or simctl diagnose logs and timestamp to your feedback.

For issues with Xcode Previews, perform the following steps to gather diagnostics:

  1. Download and install the Swift Previews logging profile for your device.
  2. Reproduce the error in Xcode Previews, if you haven’t already done so.
  3. If an error banner appears in the canvas, click the "Diagnostics" button within the banner, then go to Step 5; otherwise, continue to Step 4.
  4. If the error banner is missing, navigate the menu in Xcode: Editor > Canvas > Diagnostics
  5. In the presented sheet, click the "Generate Report" button.
  6. Attach a zip file containing the diagnostic report to your bug report (will be named something like previews-diagnostics-0123456789.zip).

Submitting your feedback Before you submit to Feedback Assistant, please confirm the following information is included in your feedback:

  • For Swift Previews
    • Xcode, system, or simctl diagnose logs, with Swift Previews logging profile, gathered after reproducing the issue
    • timestamp identifying when the issue was reproduced
    • focused sample Xcode project that reproduces the issue (if applicable)
    • screenshots or videos of the error (optional)
  • For Xcode Previews
    • Xcode Previews diagnostics report with Swift Previews logging profile, gathered after reproducing the issue
    • timestamp identifying when the issue was reproduced
    • focused sample Xcode project that reproduces the issue (if applicable)
    • screenshots or videos of the error (optional)

Please include all requested information to prevent delays in my investigation.

After your submission to Feedback Assistant is complete, please respond to this post with the Feedback ID. Once received, I can begin my investigation and determine if this issue is caused by an error within your SwiftUI app, a configuration issue within your Xcode project, or an underlying issue in the operating system, SwiftUI, in Xcode Previews, or on-device previews.

Cheers,

Paris