Swift Compiler Error: Cannot find 'ClassName.h' in scope - Xcode 13

Viewed 2212

For starters, this only became an issue after upgrading to Xcode 13. I have an app that was written in Objective-C and am utilizing some files written in Swift. In order to access classes that were created in the app in Objective-C, I do have a bridging-header named TargetName-Bridging-Header.h, where all of the classes in question are being imported like so:

#import "ClassName.h"

In the target Build Settings, Objective-C Bridging Header's value is set to the path of the bridging-header file (ProjectName/TargetName-BridgingHeader.h), and the app seems to have no problem finding it. Precompile Bridging Header is set to Yes. Install Objective-C Compatibility Header is set to Yes. Furthermore, the app builds and runs and seems to have no problem accessing those Objective-C built classes, yet the compiler continues to throw errors stating that it cannot find those classes. I've tried deleting derived data and cleaning. What am I missing? Is this perhaps a new Xcode bug that anyone else has experienced?

The exact error is "Swift Compiler Error: Cannot find 'ClassName.h' in scope"

1 Answers

Had the same problem, I removed the specific import statement from the bridging header, put it back and saved...next compilation went smooth without any errors. weird bug...but avoidable..

Related