ComposableCoreLocation is statically linked to ComposableArchitecture

When using both ComposableCoreLocation and ComposableArchitecture in a Xcode 12 (beta) project the preview canvas fails to build due to dupilaciton of frameworks. When using Xcode's swift package manager (not CLI tool with Package.swift files) it's not possible to change the static/dynamic setting.
Is it possible to dynamically link ComposableCoreLocation in the ComposableArchitecture Package.swift or am I doing something wrong?

have you tried setting DISABLE_DIAMOND_PROBLEM_DIAGNOSTIC ?
https://developer.apple.com/forums/thread/128806

1 Like

Thanks. The problem disappeared when I set DISABLE_DIAMOND_PROBLEM_DIAGNOSTIC = true in my debug xcconfig.

Now I get another problem really weird problem but I'll guess that's more related to the fact that I'm running a beta version of Xcode...

The recommended way to work around this is to create a shared framework that depends on ComposableArchitecture and ComposableCoreLocation and then depend on that framework instead of depending on each of the TCA modules directly.

We describe this in the installation instructions, and show how to do it in the Tic-Tac-Toe demo application.

It's a bit of a pain and hopefully it will be easier to do this in the future, but apparently this is the way Apple recommends for now.

1 Like

Actually, I need to correct a few things here. The advice I gave above is for when you want to import TCA from multiple modules. Due to a SPM bug you need to put your SPM dependencies in a single shared framework and then import that framework into all of your modules.

For your situation I think all you need to do is depend only on ComposableCoreLocation, and that will also give you access to ComposableArchitecture under the hood.

Here's the SPM bug that details the problems people are having with duplicate symbols: [SR-12303] Swift Package Manager package stopped working after Xcode 11.3, Xcode 12, etc. · Issue #4581 · apple/swift-package-manager · GitHub