Xcode 15 beta 1 failed to preview SwiftUI view in watchOS target

Hello!

I can't preview the SwiftUI views of watchOS target in Xcode 15 beta 1, when the containing iOS app has a SPM dependency. Reproducing steps:

  1. Create a new watchOS app project (with a companion iOS app) in Xcode 15.
  2. Both iOS and watchOS ContentView can be previewed at this step.
  3. Add a Swift package to the iOS target (the package should be an iOS-specific package, not a watchOS one, for example, https://github.com/siteline/SwiftUI-Introspect)
  4. After you add the static library to iOS target, the watchOS preview no longer work anymore.

If you check the error message, you can find the Xcode preview attempt to build the iOS package against watchOS SDK.

Accepted Reply

I'm pretty sure this is a known issue, but the best thing for us would be to file a Feedback request with a previews diagnostics file.

The most helpful thing is to download and install the logging profile for your Mac/device. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift Attach the sysdiagnose to the radar as well as the diagnostics using the instructions below.

Then when you reproduce the problem in Xcode:

  1. When the error banner appears, click the "Diagnostics" button in that banner.
  2. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  3. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

Replies

I'm pretty sure this is a known issue, but the best thing for us would be to file a Feedback request with a previews diagnostics file.

The most helpful thing is to download and install the logging profile for your Mac/device. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift Attach the sysdiagnose to the radar as well as the diagnostics using the instructions below.

Then when you reproduce the problem in Xcode:

  1. When the error banner appears, click the "Diagnostics" button in that banner.
  2. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  3. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

same problem, Xcode 14 has this problem too

  • Yes... Solve it by Edit Scheme > remove the iOS main app target from the watchOS scheme. I don't know why it's selected by default...

  • But if you do that your companion app on the iPhone won't be installed and while debugging watch app

Add a Comment

Same problem i filed feedback: FB12412988

Has this been solved? I encounter that very same issue with Xcode 15 (final version)

@yellow8 No, the issue persists.

I'm truly disappointed with the Xcode Previews team. It's not about the bugs, but their response to them. Every time I report a bug in Previews, they respond with a standard template asking for a diagnostic file. As you can see in this post, even when I provide detailed steps that reproduce the issue 100% of the time, they simply ignore them and continue to request the diagnostic file. They might even tell you it's a known issue, but still, they ask for a diagnostic file.

So, I've given up.

Post not yet marked as solved Up vote reply of Gong Down vote reply of Gong

Have the same issue, searched around but no solution was found.

You can temporary fix this problem via:

  1. Duplicate the WatchOS sheme and name it Preview-......
  2. In Edit Scheme > Build Remove the iOS companion app from the list.

Then switch to Preview- scheme when you want to preview the watchOS app Swift views.

  • Thanks for the work around. Does this have any consequences when distributing your app to the App Store?

  • This fix works. Thanks a lot.

Add a Comment

The issue was fixed in SwiftUIIntrospect 1.1.1 version.

  • Does this mean it needs to be resolved in the Swift Packages you include and not in Xcode? There are many other packages out there with the same issue.

  • @bocaxica I would say it might be fixed from Swift Package side. I'm pretty sure this issue needs to be resolved in Xcode, but constantly switching schemes is too annoying and nobody did't recieve any feedback from Apple.

Add a Comment