Excluding source files per platform

I have a framework containing source files for both iOS and tvOS; historically I would use the build settings 'EXCLUDED_SOURCE_FILE_NAMES' and 'INCLUDED_SOURCE_FILE_NAMES' to filter out the necessary files depending on the target platform. This doesn't seem to be working when defining the settings using any of the current methods (cSettings etc). Are there any other options available to achieve this?

I'd suggest moving platform-specific source files to a separate target. That would allow you to exclude such target with platform deployment settings.

Apologies, I linked to wrong proposal here. Was meaning to point to SE-0273: Package Manager Conditional Target Dependencies.

You can also enclose the source file in an #if os(...) conditional compilation block.

Terms of Service

Privacy Policy

Cookie Policy