Skip to content

module 'ComposableArchitecture' was not compiled for testing #22

@eimantas

Description

@eimantas

I added TCA to my application (without adding TCA test support). I can't seem to get the SwiftUI previews working anymore. After pressing "Resume" on the canvas I get the "Build Failed" HUD. Tapping "Diagnostics" gives me this error:

SchemeBuildError: Failed to build the scheme "App"

Build target ComposableArchitectureTestSupport:
note: Set ENABLE_PREVIEWS=NO because SWIFT_OPTIMIZATION_LEVEL=-Owholemodule, expected -Onone (in target 'ComposableArchitectureTestSupport' from project 'swift-composable-architecture')


Compile Swift source files:
/Users/eimantas/Development/DerivedData/App-cvsbxwitwserczdehyykapbndqjo/SourcePackages/checkouts/swift-composable-architecture/Sources/ComposableArchitectureTestSupport/TestStore.swift:4:18: error: module 'ComposableArchitecture' was not compiled for testing
@testable import ComposableArchitecture

I understand this is not the problem with TCA itself, but with either Xcode or my project settings.

I turned off -Owholemodule optimisation in ALL of the targets (the app has a watch app counterpart). I also turned off ENABLE_PREVIEWS. Even with that setting it tells me to turn them off. The project builds and I can run tests, but when it comes to getting the previews - for some reason I can't get it to build.

It's also strange that tests run just fine (because they don't have dependency on TCA's Test Support library) and the app builds. But previews for some reason just don't show up.

I also just checked the settings with vanilla project that contains TCA and it's test support - the build settings are identical which makes me even more confused :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions