Objective C to Swift header file with multiple targets

前端 未结 6 1683
無奈伤痛
無奈伤痛 2020-12-01 03:32

I\'m successfully calling my Swift classes from Objective C (for target \'MyApp\') via the import statement:

#import \"MyApp-Swift.h\"

I\'v

6条回答
  •  佛祖请我去吃肉
    2020-12-01 03:56

    Previous answers have some problems if you decide to rename your targets or project, or use SWIFT_MODULE_NAME as intended.

    The most universal solution is to change SWIFT_OBJC_INTERFACE_HEADER_NAME (“Objective-C Generated Interface Header Name”) under Project's, not Targets, Build Settings, to:

    • $(PROJECT_NAME)-Swift.h — one per project;
    • $(SWIFT_MODULE_NAME)-Swift.h — one per module (default value).

提交回复
热议问题