Xcode requires additional components to preview SwiftUI

Up until yesterday I was able to use preview in Xcode. I don't know if it is since my system updated to 13 (I never used the beta) but suddenly I can't use preview with SwiftUI. This is in the same project that was previewing with no issues. In response I have went to preferences-> components and downloaded the simulator for the version I'm trying to simulate, ie. IOS 14.5. This did not help.

Error says

"Xcode is missing components needed to preview on IOS"

Diagnostics says

"PlatformDoesNotHaveAgentsError: Missing required components for iOS

Xcode is missing components needed to preview on iOS

==================================

| HumanReadableSwiftError |
| LocationError: noBundle

Answered by Developer Tools Engineer in 699905022

This issue looks to be resolved in Xcode 13.2. Could you please download the latest version from the app store or https://developer.apple.com/xcode/resources/ ? If you are still seeing issues with this version then please do file a new feedback and make sure to include the preview diagnostic!

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

Have submitted this to feedback with report attached-  FB9663406

I have a work around, created an entirely new project and complied it for an IOS 15 simulator. Then changed my existing project to preview/simulator to IOS 15 and previews are fine. However, even though I have the IOS 14.5 simulator downloaded, I cannot specify a device with IOS 14.5 as a preview. It's a workaround, but not really satisfactory.

Sorry to hear you are having problems getting previews working with older simulator releases, and thank you very much for already filing and including the feedback ID here.

I've made sure the feedback has been routed to the right team, and will be duped to a known issue with a fix tracked for an upcoming release.

Sorry for any inconvenience caused.

I think, it is a serious bug, why in 14.x version simulator shows this error? This decreases learning curve of SwiftUI.

Accepted Answer

This issue looks to be resolved in Xcode 13.2. Could you please download the latest version from the app store or https://developer.apple.com/xcode/resources/ ? If you are still seeing issues with this version then please do file a new feedback and make sure to include the preview diagnostic!

  1. When you get an error in Xcode Previews, an error banner appears in the canvas
  2. Click the "Diagnostics" button in that banner
  3. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  4. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)
Xcode requires additional components to preview SwiftUI
 
 
Q