I am having trouble generating the swift header needed to use Swift classes from ObjC, when there are multiple targets with common code.
I created two targets My OSX App
and My iOS App
. These targets share common code where an ObjC class is calling a Swift class.
As described in Swift and ObjC in the same project I can add #import "My_iOS_App-Swift.h"
to my ObjC class and compile it from the My iOS App
target.
However, this doesn't compile from the My OSX App
target, as the include needs to match the module name. It is looking for #import "My_OSX_App-Swift.h"
but the common code does not use that include.
What is the correct way to mix/match Swift/ObjC in code that is shared between multiple targets? I could manually change every target to use a common MyApp-Swift.h
, but that doesn't feel right and may cause other problems.
My_iOS_App-Swift.h
orMyApp-Swift.h
. It should byMyLibrary-Swift.h
– nhgrif