Swift to Objective-C header does not contain Swift classes

前端 未结 8 2062
無奈伤痛
無奈伤痛 2020-12-16 12:18

I\'m attempting to use Swift classes in my Objective-C code, however my Swift classes don\'t seem to appear in the generated header. As a result, my build fails with \"Use o

相关标签:
8条回答
  • 2020-12-16 13:16

    Maybe you defined a Swift class with the same name as an existing Objective-C class which wouldn't be unusual if you want to refactor your Objective-C code to Swift.

    As long as you have a class defined simultaneously in Swift and Objective-C the compiler quietly stops updating the bridging header altogether ("ProductModuleName-Swift.h") - which also affects subseqeuent changes in other bridged Swift files.


    For general reference how to import Swift into Objective-C see: Importing Swift into Objective-C | Apple Developer Documentation

    0 讨论(0)
  • 2020-12-16 13:17

    Class should be declared as @objc public class

    0 讨论(0)
提交回复
热议问题