Does an 'archive build' require 'preview content'?
I've put swift source files into 'Preview Content' directories - one directory for the top-level App and one for an embedded framework. An 'archive build' fails, complaining about the code in a #Preview
block.
#Preview {
// the archive build fails to find this `default` ??
let controller = PersistenceControllerTopLevelPreview.default
let user = controller.user
...
The framework has its 'Preview Context' specified in the Development Assets
; same with the top-level App.
Hi,
#Preview
and its predecessor PreviewProvider
tend to get dead code stripped when building for release, but there are projects where lingering references might cause them to stick around. Best way to be sure they are only present in debug builds would be to wrap the definitions like so:
#if DEBUG
#Preview {
…
}
#endif
Hope that helps.