SwiftUI preview failing with failedToGenerateThunkInfo

I have an iOS app by using a swift package to hold most of the logic. However, the previews of SwiftUI views often fail with following error:
Code Block
HumanReadableSwiftError
BuildError: failedToGenerateThunkInfo(Error Domain=com.apple.xcbuild Code=19 "could not generate preview info: noTargetBuildGraph" UserInfo={NSLocalizedDescription=could not generate preview info: noTargetBuildGraph})


To reproduce this, please clone https://github.com/pointfreeco/isowords and check for preview of ChangelogView.
  • Hi, did you come to solve this issue ?

  • Unfortunately this is a bug that must be fixed in XCode. Here are some more discussions regarding the same: https://github.com/pointfreeco/swift-composable-architecture/discussions/581 with some solutions that work for sometimes.

Add a Comment

Replies

I have submitted https://feedbackassistant.apple.com/feedback/9118422 for this
  • Thanks for filing a feedback. I've made sure it's been routed to the right team so it can be addressed as soon as possible.

Add a Comment

+1 (having the exact same problem with the exact same app.)

I have started having this same issue occur with my app in Xcode 15.3:

== PREVIEW UPDATE ERROR:

    HumanReadableSwiftError
    
    BuildError: failedToGenerateThunkInfo(could not generate preview info: noTargetBuildGraph)

Is anyone experiencing the same problems? My preview, which lives in a SPM package, works totally fine in Xcode 15.2, but fails in Xcode 15.3. Any ideas for how to fix it? I've tried deleting DerivedData, resetting package caches, clean building.

So frustrating seeing these regression issues popping up still. Filed: FB13678356

I have started having this same issue occur with my app in Xcode 15.3:

== PREVIEW UPDATE ERROR:

    HumanReadableSwiftError
    
    BuildError: failedToGenerateThunkInfo(could not generate preview info: noTargetBuildGraph)

Is anyone experiencing the same problems? My preview, which lives in a SPM package, works totally fine in Xcode 15.2, but fails in Xcode 15.3. Any ideas for how to fix it? I've tried deleting DerivedData, resetting package caches, clean building.

So frustrating seeing these regression issues popping up still. Filed: FB13678356

Same error and behavior. Fails on 15.3, loads on 15.2. Feedback: FB13722734.

thanks for the feedback IDs! I'll make sure they get to the right team asap. For issues with previews generally you'll want to include the following diagnostics:

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