Post

Replies

Boosts

Views

Activity

Reply to What build setting causes `PreviewProvider`s to be stripped when archiving?
My team ran into the same problem. We fixed the issue by removing the Swift file from Developer Assets. Our understanding is that the preview mocks will be stripped since they are only used in the PreviewProvider types that are also stripped. I haven't run the validation suggested in the post you linked, though. This article was helpful to my understanding: To be clear; we’re not adding these Swift files as Development Assets as we did before with our preview assets catalog. The reason is that the compiler would fail during archiving as the code we referenced is no longer present. You could solve this using #if DEBUG checks, but that’s not always nice to use. Instead, relying on dead code stripping makes much more sense. https://www.avanderlee.com/xcode/development-assets-preview-catalog/
Dec ’22