How can I import Swift code to Objective-C?

前端 未结 15 2740
南方客
南方客 2020-11-22 02:52

I have written a library in Swift and I wasn\'t able to import it to my current project, written in Objective-C.

Are there any ways to import it?

#i         


        
15条回答
  •  生来不讨喜
    2020-11-22 03:20

    Go to build settings in your project file and search for "Objective-C Generated Interface Header Name. The value of that property is the name that you should include.

    If your "Product Module Name" property (the one that the above property depends on by default) varies depending on whether you compile for test/debug/release/etc (like it does in my case), then make this property independent of that variation by setting a custom name.

提交回复
热议问题