Xcode 16 preview not working

I want to add SwiftUI to an existing package. Super simple to get started. It previews with Xcode 15.4, but gives an error on Xcode 16.0: JITError: Runtime linking failure

Anyone have an idea on what may be failing?

Full SwiftUI code:

import SwiftUI

struct Dashboard: View {
    var body: some View {
        Text("hello")
    }
}

#Preview {
    Dashboard()
}

Use Legacy Previews Execution is working so far.

Hello @MegaWatt, our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a sysdiagnose and the time you were able to reproduce the issue, and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Very sorry to hear you're having trouble getting previews working. The best next step will be to file a feedback with some extra 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)

Generate the sysdiagnose(s) and attach those too.

I believe I have hit the same issue. Using Legacy Previews Execution is a TEMPORARY fix for the moment, but I would be happy to contribute any diagnostic info to help resolve this.

Broad facts:

  • Our Swift Package references a binary XCFramework (which is statically linked for iOS devices and simulators; it's a Rust shared library so we cannot change the structure).
  • SwiftUI previews, even ones which do not reference the shared code, fail with a runtime link error complaining about JIT and not being able to find all(?) of the symbols from our static library framework.
  • Enabling legacy previews works
  • There have never been any issues running either on device or on a full simulator; the binary framework is fine.

You can find an up to date log of similar issues we've identified, error logs, and more here: https://github.com/stadiamaps/ferrostar/issues/344.

Regarding the request for diagnostics @Frameworks Engineer , I gave this a shot last week but am unsure how to proceed. The instructions appear to be highly specific for on-device previews, which are not a normal workflow for anyone I know (we use previews on our macs). I tried to do the device previews, but was unsuccessful figuring out how to trigger a sysdiagnose at the right time. (I did get the profile installed, but the instructions for how and when to generate the sysdiagnose were extremely confusing). If you can provide any help, I'd be happy to gather any information I can to help you identify the root cause.

Xcode 16 preview not working
 
 
Q