Skip to content

SwiftUI Previews and Static Library #5318

Discussion options

You must be logged in to vote

Hi @lordcodes

We ran into a similar issue 😞

From our investigation it seems the build process for Previews is excluding Resource bundle targets all together resulting in them being missing and any access to them subsequently failing.

One approach we're experimenting with is for development generating a workspace that is slightly different than for regular builds, one where all targets are dynamic (while keeping them static for regular builds).

In Tuist, you can leverage Generation Time Configuration to aid this, for example

TUIST_PREVIEWS=1 tuist generate

And in the manifests:

func productType() -> ProductType {
   if Environment.previews.getBoolean(default: false) {
     return .framewor…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lordcodes
Comment options

Answer selected by lordcodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants