[Swift UI] Updating took more than 5 Seconds - Xcode 16 Beta 5

I've been getting this error after getting Xcode 16 Beta 5.


    UpdateTimedOutError: Updating took more than 5 seconds
    
    Updating a preview in DeckOptimizer.app (2065) took more than 5 seconds.
    
    Preview Preflight | Registry-ContentView.swift#1[preview]: from Editor(2397) for local

Can somebody point me at the correct direction to fix this?

Answered by DTS Engineer in 799180022

If Registry-ContentView.swift is a large and complex view with many dependencies, consider breaking it down into smaller, more manageable views.

  • To avoid recreating expensive objects for each preview in SwiftUI, you can create these objects once using a preview modifier and then pass that modifier into your preview with the Preview(_:traits:_:body:) macro. For detailed guidance, refer to the Make complex objects reusable with a preview modifier section.

  • Ensure that you pass only the necessary data to your views, avoiding objects that fetch data. This practice simplifies setting up view previews and improves performance.

If these steps don't resolve your issue, please file a Feedback report and be sure to include the diagnostics:

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 to 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 (it will be named something like previews-diagnostics-0123456789.zip).

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 post the Feedback ID number here for the record.

If Registry-ContentView.swift is a large and complex view with many dependencies, consider breaking it down into smaller, more manageable views.

  • To avoid recreating expensive objects for each preview in SwiftUI, you can create these objects once using a preview modifier and then pass that modifier into your preview with the Preview(_:traits:_:body:) macro. For detailed guidance, refer to the Make complex objects reusable with a preview modifier section.

  • Ensure that you pass only the necessary data to your views, avoiding objects that fetch data. This practice simplifies setting up view previews and improves performance.

If these steps don't resolve your issue, please file a Feedback report and be sure to include the diagnostics:

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 to 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 (it will be named something like previews-diagnostics-0123456789.zip).

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 post the Feedback ID number here for the record.

[Swift UI] Updating took more than 5 Seconds - Xcode 16 Beta 5
 
 
Q