Import Swift Code into Objective-C File

I created a Swift project and imported Objective-C files. During import, Xcode asked me to create a bridge header and create a header.

Now in the Objective-C files of the same project, I want to use the Swift class methods. I googled about importing Swift code in an Objective-C file. I found that we need to import ProjectName-Swift.hinto an Objective-C file. My questions are as follows:

  • ProjectName-Swift.h is not created by Xcode. How to create this file?
  • After creating the ProjectName-Swift.h file, how to use the Swift file methods in Objective-C files?
+4
source share
1

, ProjectName-Swift.h . #import ProjectName-Swift.h Obj-C, .

+2

Source: https://habr.com/ru/post/1605946/


All Articles