Hi,
You're here because your project has issues related to Xcode Previews or Swift Previews. The issue you're experiencing may be the result of any of the following:
An error in your SwiftUI app, Xcode previews, or on-device previews.
A configuration error in your Xcode project, including any third-party dependencies or packages.
A system issue in the operating system, SwiftUI, or in Xcode Previews.
Based on your request, I need more information about your SwiftUI app when rendering Xcode Previews or on-device previews. Specifically, I’ll need the diagnostics Swift Previews generates to make sure I understand the error encountered by the preview system. Please create a report in Feedback Assistant to share the details requested in the instructions below.
For issues with macOS, Mac Catalyst, on-device iOS, or on-device visionOS previews, perform the following steps to gather diagnostics:
Download and install the Swift Previews logging profile for your device.
Reproduce the error while previewing on device, taking note of the timestamp when the error occurred.
Attach the Previews diagnostics, sysdiagnose from your Mac, a sysdiagnose from the previewing iOS or visionOS device.
For issues with Xcode Previews, perform the following steps to gather diagnostics:
Download and install the Swift Previews logging profile for your device.
Reproduce the error in Xcode Previews, if you haven’t already done so.
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.
If the error banner is missing, navigate to the menu in Xcode: Editor > Canvas > Diagnostics
In the presented sheet, click the "Generate Report" button.
Attach a zip file containing the diagnostic report to your bug report (it will be named something like previews-diagnostics-0123456789.zip).
Submitting your feedback
Before you submit to Feedback Assistant, please confirm the following information is included in your feedback:
with the Swift Previews logging profile installed, attach the sysdiagnose logs gathered after reproducing the issue
the Previews diagnostics generated by Xcode
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 include all requested information to prevent delays in my investigation.
After your submission to Feedback Assistant is complete, please respond to your original Forums post with the Feedback ID. Once received, I can begin my investigation and determine if this issue is caused by an error within your SwiftUI app, a configuration issue within your Xcode project, or an underlying issue in the operating system, SwiftUI, in Xcode Previews, or on-device previews.
Cheers,
Paris X Pinkney | WWDR | DTS Engineer
Xcode Previews
RSS for tagCreate an app UI and configure almost everything your users see using Xcode Previews.
Posts under Xcode Previews tag
80 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have a view inside a Swift Package that relies on an external Swift Package. My Preview Canvas breaks as soon as I use code from the external package:
import ComplexModule // From swift-numerics
import SwiftUI
struct MyView: View {
// Commenting out this line will make Previews work
let number: Complex<Double> = 123
var body: some View {
Text("Hello World")
}
}
#Preview {
MyView()
}
This is part of the error the preview emits:
== PREVIEW UPDATE ERROR:
GroupRecordingError
Error encountered during update group #33
==================================
| [Remote] JITError: Runtime linking failure
|
| Additional Link Time Errors:
| Symbols not found: [ _$sSd10RealModule0A0AAMc, _$s13ComplexModule0A0VMn, _$s13ComplexModule0A0V14integerLiteralACyxG07IntegerD4TypeQz_tcfC ]
|
| ==================================
|
| | [Remote] LLVMError
| |
| | LLVMError: LLVMError(description: "Failed to materialize symbols: { (static-MyTarget, { __replacement_tag$1 }) }")
Did anyone else see this before?
I'm experiencing the following error with my SwiftData container when running a build:
Code=134504 "Cannot use staged migration with an unknown model version."
Code Structure - Summary
I am using a versionedSchema to store multiple models in SwiftData. I started experiencing this issue when adding two new models in the newest Schema version. Starting from the current public version, V4.4.6, there are two migrations.
Migration Summary
The first migration is to V4.4.7. This is a lightweight migration removing one attribute from one of the models. This was tested and worked successfully.
The second migration is to V5.0.0. This is a custom migration adding two new models, and instantiating instances of the two new models based on data from instances of the existing models. In the initial testing of this version, no issues were observed.
Issue and Steps to Reproduce
Reproduction of issue: Starting from a fresh build of the publicly released V4.4.6, I run a new build that contains both Schema Versions (V4.4.7 and V5.0.0), and their associated migration stages. This builds successfully, and the container successfully migrates to V5.0.0. Checking the default.store file, all values appear to migrate and instantiate correctly.
The second step in reproduction of the issue is to simply stop running the build, and then rebuild, without any code changes. This fails to initialize the model container every time afterwards. Going back to the simulator after successive builds are stopped in Xcode, the app launches and accesses/modifies the model container as normal.
Supplementary Issue: I have been putting up with the same, persistent issue in the Xcode Preview Canvas of "Failed to Initialize Model Container" This is a 5 in 6 build issue, where builds will work at random. In the case of previews, I have cleared all data associated with all previews multiple times. The only difference being that the simulator is a 100% failure rate after the initial, successful initialization. I assume this is due to the different build structure of previews. Lastly, of note, the Xcode previews fail at the same line in instantiating the model container as the simulator does. From my research into this issue, people say that the Xcode preview is instantiating from elsewhere. I do have a separate model container set up specifically for canvas previews, but the error does not occur in that container, but rather the app's main container.
Possible Contributing Factors & Tested Facts
iOS: While I have experienced issues with SwiftData and the complier in iOS 26, I can rule that out as the issue here. This has been tested on simulators running iOS 18.6, 26.0.1, and 26.1, all encountering failures to initialize model container. While in iOS 18, subsequent builds after the successful migration did work, I did eventually encounter the same error and crash. In iOS 26.0.1 and 26.1, these errors come immediately on the second build.
Container Initialization for V4.4.6
do {
container = try ModelContainer(
for:
Job.self,
JobTask.self,
Day.self,
Charge.self,
Material.self,
Person.self,
TaskCategory.self,
Service.self,
migrationPlan: JobifyMigrationPlan.self
)
} catch {
fatalError("Failed to Initialize Model Container")
}
Versioned Schema Instance for V4.4.6 (V4.4.7 differs only by versionIdentifier)
static var versionIdentifier = Schema.Version(4, 4, 6)
static var models: [any PersistentModel.Type] {
[Job.self, JobTask.self, Day.self, Charge.self, Material.self, Person.self, TaskCategory.self, Service.self]
}
Container Initialization for V5.0.0
do {
let schema = Schema([Jobify.self,
JobTask.self,
Day.self,
Charge.self,
MaterialItem.self,
Person.self,
TaskCategory.self,
Service.self,
ServiceJob.self,
RecurerRule.self])
container = try ModelContainer(
for: schema, migrationPlan: JobifyMigrationPlan.self
)
} catch {
fatalError("Failed to Initialize Model Container")
}
Versioned Schema Instance for V5.0.0
static var versionIdentifier = Schema.Version(5, 0, 0)
static var models: [any PersistentModel.Type] {
[
JobifySchemaV500.Job.self,
JobifySchemaV500.JobTask.self,
JobifySchemaV500.Day.self,
JobifySchemaV500.Charge.self,
JobifySchemaV500.Material.self,
JobifySchemaV500.Person.self,
JobifySchemaV500.TaskCategory.self,
JobifySchemaV500.Service.self,
JobifySchemaV500.ServiceJob.self,
JobifySchemaV500.RecurerRule.self
]
}
Addressing Differences in Object Names
Type-aliasing: All my model types are type-aliased for simplification in view components. All types are aliased as 'JobifySchemeV446.<#Name#>' in V.4.4.6, and 'JobifySchemaV500.<#Name#>' in V5.0.0
Issues with iOS 26: My type-aliases dating back to iOS 17 overlapped with lower level objects in Swift, including 'Job' and 'Material'. These started to be an issue with initializing the model container when running in iOS 26. The type aliases have been renamed since, however the V4.4.6 build with the old names runs and builds perfectly fine in iOS 26
If there is any other code that may be relevant in determining where this error is occurring, I would be happy to add it. My current best theory is simply that I have mistakenly omitted code relevant to the SwiftData Migration.
I am getting this error msg when I try to run a SwiftUI Preview on an iOS 15.5 simulator:
Termination Reason: Namespace DYLD, Code 1, Library missing
| Library not loaded: /usr/lib/swift/libswift_StringProcessing.dylib
| Referenced from: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libLiveExecutionResultsLogger.dylib
| Reason: tried: '/Users/hfg/Library/Developer/Xcode/DerivedData/Testios15sim-aawlbfbtggzozseoekycwwpadhrc/Build/Intermediates.noindex/Previews/iphonesimulator/Testios15sim/Products/Debug-iphonesimulator/libswift_StringProcessing.dylib' (no such file), '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswift_StringProcessing.dylib' (no such file), '/usr/lib/swift/libswift_StringProcessing.dylib' (no such file), '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libswift_StringProcessing.dylib' (no such file)
FYI I tried with the Legacy Preview Execution both on and off
Hello,
I am facing a recurring issue with Xcode iOS simulator (preview). I want to preview a SwiftUI for iOS in Xcode, but the Simulator app fails to boot up.
I receive the following error in Xcode:
Cannot Preview in this file. Simulator was shutdown during an update.
I have tried the following:
Completely uninstalling XCode and deleting all developer data, then reinstalling everthing again.
Shutdown and restart
Deleting all developer data, deleting XCode cache
Reinstalling iOS Simulator runtimes and reconfiguration of simulators.
Tested using different simulator and runtime versions.
"xcrun simctl --set previews delete al"
My reported issues:
FB20987522
FB20485454
Thank you
Best regards,
Jens
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Xcode Previews
Xcode
Simulator
Business and Enterprise
Hello,
I am facing a recurring issue with Xcode iOS simulator (preview). I want to preview a SwiftUI for iOS in Xcode, but the Simulator app fails to boot up.
I receive the follow error in Xcode:
Cannot Preview in this file. Simulator was shutdown during an update.
I have tried the following:
Uninstall Xcode and reinstall it again
Deleting all developer data
Deleting Xcode cache
Reinstalling iOS Simulator runtimes and reconfiguration of simulators.
Tested using different simulator and runtime versions.
"xcrun simctl --set previews delete al"
I reported the issue:
FB20485454
FB20987522
Thank you.
Best regards,
Jens
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Xcode Previews
Xcode
Simulator
Business and Enterprise
My main app target builds fine and can run on Simulator without issue.
Whenever I try to run a Preview, I get this error:
== DATE:
Monday, November 3, 2025 at 2:52:23 PM Pacific Standard Time
2025-11-03T22:52:23Z
== PREVIEW UPDATE ERROR:
SimulatorShutdownUnexpectedlyError: Simulator was shutdown during an update
Simulator [F85A5AF1-F52C-4662-AFCD-762F87AF537D] failed to boot and may have crashed.
This seems like it started happening after updating to MacOS 26. I've tried reinstalling all Simulators, tried on Xcode 26, deleted derived data, restarted Xcode and my Mac several times.
What other troubleshooting steps can I take?
When following the official SwiftUI Tutorial "Landmarks", I should be able to Cmd-Ctrl-Click an element of a preview in Selectable mode to view a list of options. But Xcode shows only one option (Embed). Furthermore, if I try to type anything the popover breaks completely and grows in length infinitely. I am not sure whether this is a bug, or I missed something when installing Xcode, or both
My MBP M1 Pro gets really hot. iOS 26.1 Simulator in Xcode 26.1 makes ReportCrash process run at 60-160% of CPU shows Activity Monitor.
MacOS 26.1. I've reported this via Feedback Assistant: FB20918609.
Is there a way to quit this process permanently? When I Force Quit this it opens again immediately. Only way to stop it is to quit Simulator. But then again, I need to use the Simulator.
I am trying to make build for my project followed all step and all but Igot
Showing Recent Errors Only
Build target PCS_EmpApp of project PCS_EmpApp with configuration Debug
ProcessInfoPlistFile /Users/mayankjain/Library/Developer/Xcode/DerivedData/PCS_EmpApp-bhccfqkphneiyabcysmesvskjrrm/Build/Products/Debug-iphonesimulator/PCS_EmpApp.app/Info.plist /Users/mayankjain/Downloads/RetailApp/PCS_EmpApp/obj/Debug/net9.0-ios/iossimulator-arm64/xcsync/Info.plist (in target 'PCS_EmpApp' from project 'PCS_EmpApp')
cd /Users/mayankjain/Downloads/RetailApp/PCS_EmpApp/obj/Debug/net9.0-ios/iossimulator-arm64/xcsync
builtin-infoPlistUtility /Users/mayankjain/Downloads/RetailApp/PCS_EmpApp/obj/Debug/net9.0-ios/iossimulator-arm64/xcsync/Info.plist -producttype com.apple.product-type.application -genpkginfo /Users/mayankjain/Library/Developer/Xcode/DerivedData/PCS_EmpApp-bhccfqkphneiyabcysmesvskjrrm/Build/Products/Debug-iphonesimulator/PCS_EmpApp.app/PkgInfo -expandbuildsettings -format binary -platform iphonesimulator -o /Users/mayankjain/Library/Developer/Xcode/DerivedData/PCS_EmpApp-bhccfqkphneiyabcysmesvskjrrm/Build/Products/Debug-iphonesimulator/PCS_EmpApp.app/Info.plist
error: Build input file cannot be found: '/Users/mayankjain/Downloads/RetailApp/PCS_EmpApp/obj/Debug/net9.0-ios/iossimulator-arm64/xcsync/Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'PCS_EmpApp' from project 'PCS_EmpApp')
Build input file cannot be found: '/Users/mayankjain/Downloads/RetailApp/PCS_EmpApp/obj/Debug/net9.0-ios/iossimulator-arm64/xcsync/Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
error .
I tried but unable to solve it .
Hello,
I'm experiencing consistent crashes of XCPreviewAgent when using Xcode Previews on macOS 26.0.1 Tahoe (25A362).
Configuration:
macOS: 26.0.1 (25A362) - stable release
Xcode: 16.0 (23.0.54) - stable release
Hardware: MacBook Pro M4
Project: SwiftUI iOS app
Issue:
Every time I try to use Xcode Previews, XCPreviewAgent crashes with:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x0000000340e54000
Termination Reason: Namespace SIGNAL, Code 10, Bus error: 10
The crash occurs in shared memory region during dynamic library loading.
What I've tried:
Cleared all caches: rm -rf ~/Library/Developer/Xcode/DerivedData
Deleted Preview data: rm -rf ~/Library/Developer/Xcode/UserData/Previews
Reset simulators: xcrun simctl --set previews delete all
Switched xcode-select to /Applications/Xcode.app/Contents/Developer
Tried both Xcode stable and Xcode beta
Created fresh simulators
Clean build (Cmd+Shift+K)
Rebooted Mac multiple times
The app runs fine on simulator (Cmd+R), but Previews consistently crash.
I am experiencing an issue where my Mac's speakers will crackle and pop when running an app on the Simulator or even when previewing SwiftUI with Live Preview.
I am using a 16" MacBook Pro (i9) and I'm running Xcode 12.2 on Big Sur (11.0.1).
Killing coreaudiod temporarily fixes the problem however this is not much of a solution.
Is anyone else having this problem?
I’ve hit a strange SwiftUI preview crash that happens on macOS previews when using a view inside a List’s ForEach, resulting in the error Fatal Error in TableViewListCore_Mac2.swift.
Only crashes macOS preview - iPhone/iPad preview doesn't crash.
Doesn't crash when actually running the app.
Here’s a minimal reproducible example, causing the preview to crash.
XCode: Version 26.0.1 (17A400)
MacOS: 26.0.1 (25A362)
import SwiftUI
struct Item: Identifiable {
let id = UUID()
let name: String
}
struct ItemRow: View {
let item: Item
var body: some View {
HStack {
Button(action: {}) { Image(systemName: "play") }
Text(item.name)
Spacer()
ProgressView()
}
}
}
struct ContentView: View {
@State private var items = [
Item(name: "Item A"),
Item(name: "Item B"),
]
var body: some View {
List {
ForEach(items) { item in
ItemRow(item: item)
}
}
}
}
#Preview("Content view") {
ContentView()
}
#Preview("Item row") {
ItemRow(item: Item(name: "Item A"))
}
If I wrap the row in a container, like this:
ForEach(items) { item in
ZStack {
ItemRow(item: item)
}
}
the crash seems to disappear.
Has anyone else seen this behavior?
What might I be doing wrong?
Any ideas about what could be causing this?
When I enable the Mergeable library in Xcode, SwiftUI preview will be not available, and the error is as follows.
Cannot preview in this file
Could not analyze the built target description for Demo to create the preview.
arguments: -no_merge_framework: Failed parsing Mach-O file Assets
Report
I’ve noticed a strange bug in Xcode 16 and Swift. When a preview is rendering and hasn’t finished yet and you run an app to debug, Xcode is launching two instances of the app. Has anyone else noticed this issue? If you let the preview finish rendering before running the app, this doesn’t happen. Very odd.
Suppose you have a view:
struct Library: View {
@State var books = []
var body: some View {
VStack {
...
Button("add Book") {
....
}
}
}
Such that Library view holds a Book array that gets populated internally via a button that opens a modal – or something alike.
How can I use #Peviews to preview Library with a pre-populated collection? Suppose I have a static books – dummy – array in my code just for that; still, what's the best way to use that to preview the Library view?
I am facing a recurring issue with Xcode iOS simulator. I want to preview a SwiftUI for iOS in Xcode, but the Simulator app fails to boot up.
I receive the follow error in Xcode:
Cannot Preview in this file. Simulator was shutdown during an update.
I have tried the following:
Deleting Xcode cache
Reinstalling iOS Simulator runtimes
Completely uninstalling Xcode and deleting all developer data, then reinstalling
None of the above steps fix the problem. The only fix I have found is to completely reinstall MacOS 15.4.1. THIS IS TERRIBLE!
I have already reinstalled MacOS 15.4.1 once to fix the issue, and I don't want to do it again. If there is another solution, please help me find it!
Thank you!!
The steps to reproduce this issue are a bit complicated.
In my app, previewing View A in Package P works fine, but another view in the same package fails to preview.
The error message is shown below. It seems that the memory used for the preview is interfering with the shared memory area.
This is reported as FB18519266
Exception Subtype: KERN_PROTECTION_FAILURE at 0x00000003402d8900
Exception Codes: 0x0000000000000002, 0x00000003402d8900
VM Region Info: 0x3402d8900 is in 0x3402c8000-0x340a18000; bytes after start: 67840 bytes before end: 7599871
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
mapped file 3401dc000-3402c8000 [ 944K] r-x/rwx SM=COW Object_id=57e4ac
---> shared memory 3402c8000-340a18000 [ 7488K] rw-/rw- SM=SHM
mapped file 340a18000-340f38000 [ 5248K] r-x/rwx SM=COW Object_id=1dc9a049
Termination Reason: ****** 10 Bus error: 10
Terminating Process: exc handler [94787]
I have an issue with Xcode that it crashes my Macbook and restarts it instantly when I unpause the preview canvas.
I managed to make it run for a minute longer by not watching a youtube video.
I am writing a very simple SwiftUI project for iOS nothing too big to warrant any issues.
Does anyone have a solution to fix this?
Macbook Pro M3 16GB RAM, 500GB SSD (plenty of storage space)
Tahoe 26.0
I can't use Xcode without it crashing.
Just writing a very simple iOS app with SwiftUI (using only forms and sections). Whenever my canvas updates to correspond to my changes it forces my Macbook to restart.
Does anyone have a solution for this. I'll be honest it's becoming really frustrating.
Thank you.
Macbook M3 Pro 16GB ram, 500gb Space (400gb free space)