How to exclude SPM dependency for Catalyst?

Hi, guys!

I created a empty Xcode project with catalyst support and added one dependency YandexMobileMetrica via Swift Package Manager.

YandexMobileMetrica not support Catalyst architecture, so I need exclude this framework for macOS.

I opened section "Frameworks, Libraries" and I switched value from "iOS + macOS" to "iOS".

Then I wrapped the code:

Code Block #if !targetEnvironment(macCatalyst)import YandexMobileMetrica#endif

But I'm getting an error:

Code Block languageWhile building for Mac Catalyst, no library for this platform was found in '/Users/mezhevikin/Library/Developer/Xcode/DerivedData/catalyst-spm-test-gapaedifaylhvwatazbwfppyplvj/SourcePackages/artifacts/YandexMobileMetrica/YandexMobileMetricaCrashes.xcframework'.

https://github.com/mezhevikin/catalyst-spm-test - example of problem

How to exclude SPM dependency for Catalyst?

3 Likes

Similar question to Disabling binary dependencies for Catalyst that that has gone unanswered since December.