SwiftUI Preview Canvas Module

568 Views Asked by At

I have 3 different configurations for my project (Local, Dev, Release) and I can't get SwiftUI preview to work.

Compiling failed: no such module 'MyProject'...
Objects-normal/x86_64/MyView.2.preview-thunk.swift:1:64: error: no such module 'MyProject'
@_private(sourceFile: "MyView") import MyProject

As far as I understood, problem is with module name where preview canvas is trying to resolve main release name 'MyProject', but in debug it should be MyProject_Local (at least that value is set under Build Settings => Packaging => Product Module Name).

I would probably be able to hack this by setting my Debug product module name to "MyProject", but I was wondering if I can force preview canvas to somehow use correct configuration?

0

There are 0 best solutions below