I'm not sure what version of Xcode you're running, but is it possible that you're running into this known issue from the beta?
Known Issues
Previewing view code in a SwiftData app results in a linker failure for the canvas despite that code compiling successfully for device and simulator. (111657477)
Workaround: Run your app in the simulator to test your UI instead of using Previews.
Source: Xcode beta release notes
Post
Replies
Boosts
Views
Activity
The correct feedback ID is: FB14007895. Please ignore the one in the post.
Hi there, I have the same issue on Xcode Beta 1 and 2 where a file with about 400 structs will crash Xcode when building locally for a preview, or on device.
When viewing the running processes in Activity Monitor swift-frontend has about 10 or so processes each consuming 9GB+ of memory, which eventually causes a complete crash of the system.
Commenting out most of the structs (to leave about 100 or so) resolves this issue.
Happy to provide whatever I can to help resolve this.
Hi, do you have an update on this please? I'm getting crashes from sessions in production from customers on iOS 18.0. This appears to still be happening Beta 5 of iOS 18.1. Let me know if I can provide more information beyond what others have shared in the thread. Thank you so much!