Xcode 14.3.1 Not Updating Obj-C Generated Interface Header

For the last week Xcode has simply refused to update the Swift Bridging Header when I add new Swift Classes?! It is getting to be a real pain in ****. I refactor a class into Swift then have to spend 2 days trying to get Xcode to see the new class. What the heck?! Anyone have any clue what is going on here and how to fix this?

This is a MacOS Project that is quite old and has a lot of Obj-C that I have been refactoring over to Swift class by class. It was fine until recently, but lately it has been rather tough sledding.

I have tried:

  1. Numerous clean and rebuilds.

  2. Deleting the derived data folder manually.

  3. Renaming the ProjectName-Swift.h file - One time doing that seemed to cause Xcode to notice and it rebuilt it but not subsequent times.

  4. Double checked all the settings. These are the settings for the Relevant section and all looks ok to me according to the Docs.

I am out of ideas and while I see people running into this issue I have not found a reliable way to fix this.

Answered by cliffr in 758184022

So the only solution I was able to arrive it was to:

  1. NOT use the same name for the Swift Class as the old class being refactored into Swift.
  2. Have BOTH in the project.
  3. Get it to build.
  4. Then go back and change all the references to the old class name to new class name.

This was the ONLY way to get the ProjectHeader-Swift.h to get built and include the class. This file should probably be built on the fly and dynamically as long as there are no errors in any Swift Classes.

How does one get around this circle jerk issue?! The Swift file has NO compile errors that I can see but other things will not build because they are not seeing the full definition of the Swift class and are complaining about the forward Class not having various properties defined in the Swift class. Seriously Apple this is a bit backwards no? Xcode should automatically generate that file as long as there are no build issues in a Swift class.

Accepted Answer

So the only solution I was able to arrive it was to:

  1. NOT use the same name for the Swift Class as the old class being refactored into Swift.
  2. Have BOTH in the project.
  3. Get it to build.
  4. Then go back and change all the references to the old class name to new class name.

This was the ONLY way to get the ProjectHeader-Swift.h to get built and include the class. This file should probably be built on the fly and dynamically as long as there are no errors in any Swift Classes.

Xcode 14.3.1 Not Updating Obj-C Generated Interface Header
 
 
Q