Problems with Tuist and TCA that don't show previews

Everyone, do you happen to
After multi-modularization
Will TCA work normally in previews?

After multi-modularization (Xconigs separation)
There is an issue where the preview does not come out.

The Tuist version is currently using 4.51.1.
에러문구는 Failed to launch previews.com.apple.PreviewAgent.iOS
does not work with the error
The build is operating normally with a simulator or a practical machine.

I need your help.

Hi @Little-tale and welcome to the forum :wave:

Unfortunately, the unreliability of SwiftUI previews is somewhat challenging to debug because their implementation is closed source. However, what we learned from users is that they generally work better when dynamic frameworks are used, so I’d recommend playing with that.

Do you by any chance have access to more in-detail stacktraces from the previews feature?

@pepicrft Thx For your Reply

First, in the following way The preview problem has been solved to some extent.

private let tcaDynamics: [String : Product] = [
"ComposableArchitecture": .framework,
"Dependencies": .framework,
"CombineSchedulers": .framework,
"Sharing": .framework,
"SwiftUINavigation": .framework,
"UIKitNavigation": .framework,
"UIKitNavigationShim": .framework,
"ConcurrencyExtras": .framework,
"Clocks": .framework,
"CustomDump": .framework,
"IdentifiedCollections": .framework,
"XCTestDynamicOverlay": .framework,
"IssueReporting": .framework,
"_CollectionsUtilities": .framework,
"PerceptionCore": .framework,
"Perception": .framework,
"OrderedCollections": .framework,
"CasePaths": .framework,
"DependenciesMacros": .framework,
"FlowStacks": .framework
]

But there’s another problem

After “Tuist clean”
“Generate” will cause build errors in the practical machine or simulation.

External macro implementation type 'CasePathsMacros.CasePathableMacro' could not be found for macro 'CasePathable()'; '/Users/jaehyungkim/Library/Developer/Xcode/DerivedData/Goolbitg-iOS-cykyhzsppetvnjevsxfztglgrnuv/Build/Products/Debug-iphoneos/CasePathsMacros' produced malformed response

To solve this problem
In the “Derived Data” folder, click the “Debug-iphoneos” folder
If you delete it and rebuild it, it will solve the problem
Every time after “CleanBuild”, the process is too cumbersome. What should I do
It’s hard…

  • But this is not good either…
    Because it won’t be able to be put in the archive…
    Macro should be exclusive to macOS, but I tried to do it on iOS
    There’s a problem

We can resolve the above issue.

First, Set dependencies for “TCA” and “TCACoordinator” From the “Package.Swift” file.

private let tcaDynamics: [String : Product] = [
    "ComposableArchitecture": .framework,
    "Dependencies": .framework,
    "CombineSchedulers": .framework,
    "Sharing": .framework,
    "SwiftUINavigation": .framework,
    "UIKitNavigation": .framework,
    "UIKitNavigationShim": .framework,
    "ConcurrencyExtras": .framework,
    "Clocks": .framework,
    "CustomDump": .framework,
    "IdentifiedCollections": .framework,
    "XCTestDynamicOverlay": .framework,
    "IssueReporting": .framework,
    "_CollectionsUtilities": .framework,
    "PerceptionCore": .framework,
    "Perception": .framework,
    "OrderedCollections": .framework,
    "CasePaths": .framework,
    "DependenciesMacros": .framework,
    "FlowStacks": .framework // TCACoordinator
]

Most TCA, TCACoordinators’ preview problems are
It’s resolved through the above method.

However, if there is a problem even if you set it like this
To solve this problem
Delete all “YOUR_SCHEME”-iphoneos contents in “Derived Data” folder
Rebuilds will resolve the issue.