1

In my project, I use multiple SPM to split up my app into smaller chunks/modules. This works perfect, including SwiftUI previews which can include views from other modules as well.

Unless there are Images involved; then the preview agent crashes. I created a small Pot showing this... https://github.com/arkulpa/SPMAssetPOC

Images are shown correctly as long as the preview only contains views with assets from the current SPM, but as soon as there's a view (including an asset) from another SPM, the PreviewAgent crashes...

enter image description here

1 Answer 1

1

This is definitely a bug. The issue is related to loading bundle resources transitively.

"This is a known issue when using resources of transitive dependencies while previewing a standalone package. Using an app as the preview host as you are doing is the recommended workaround at the moment."

See the Swift forums here for more details: https://forums.swift.org/t/xcode-previews-swiftpm-resources-xcpreviewagent-crashed/51680

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.