/SPM-Semantic-Imports

This is a demo project to showcase an error found in SPM using Objective-C

Primary LanguageSwift

Problem Statement

Running swift build on this project succeeds, while building after generating and opening the Xcode project fails with:

Use of '@import' when modules are disabled

in this line.

Environment

  • Xcode 12.0 (12A7208)
  • Swift 5.3

Repro steps

  1. Run swift package generate-xcodeproj
  2. Run open Example.xcodeproj
  3. Select Mac in the simulator dropdown
  4. Build Xcode project

What I've tried

Overriding configs:

I've tried creating an Settings.xcconfig with the following iterations:

DEFINES_MODULE = YES;
CLANG_MODULES_AUTOLINK = YES;
CLANG_ENABLE_MODULES = YES;

And then running swift package generate-xcodeproj --xcconfig-overrides Settings.xcconfig.

This has not worked.


Update: How to fix this

This PR exemplifies how to fix this problem