I have a MacOS project with several targets and in which I have been refactoring Obj-C classes over to Swift 1 by 1. I have been doing this for months and all was fine and building well until the most recent class. But with that one the project simply refuses to build.
I see the ProjectName-Swift.h file in the Project folder but the last build date was over a week ago and so it obviously does not include the new class, hence Xcode is complaining it can't find the new Swift Class.
Understand the following before answering please:
- This is a very old and longstanding MacOS project with several targets, it is NOT a new MacOS project.
- I have previously added quite a few other Swift classes (using Swift 5) to this project and was able to build and run just fine.
- I have tried clean and build about 50 times and removing derived data. Nothing will force a rebuild of the ProjectName-Swift.h and the new class is definitely NOT in there.
- There are no other build issues with this project, just the one related to not being able to see the new class.
- The class was previously implemented in Obj-C and I was porting it over and that old class file is not referenced by the project at the moment.
- This Swift class
ChartListTableCellView
is NOT referenced in the obj.h file so it is not forward referenced there. - The Bridge Header is imported in the .m that is complaining.
Because Xcode is not seeing the Swift Class in the ProjectName-Swift.h it will not build and I am sort of in a chicken and egg circle jerk here. I even tried using the old Header at the top of the .m file where I need this class and it gets further but not far enough to build the Bridge Header.
This is how the new class is declared so it should be visible.
@objcMembers class ChartListTableCellView : NSView
{
private let grayBottomBorder = NSView()
...
init() {
super.init(frame: NSMakeRect(0, 0, 0, 0))
...
}
...
}
I am stumped and am out of ideas.
Apple!! Seriously there needs to be a simple way to force a rebuild of the ProjectName-Swift.h file.