0

I cannot get my swift files imported into my Obj-C project. I know, there’s a lot already on this topic on stack overflow, and I’ve tried all answers in this thread on importing Swift code to Objective-C, but I've still got the same error in spite of what I've tried for my project called Plantasia: When at the top of the script of the .m file of a pre-existing project I do

import "Plantasia-Swift.h"

I get file not found error. What I've tried:

I've set for both project and example

  • "Defines Module" : YES
  • "Always Embed Swift Standard Libraries" : YES
  • "Install Objective-C Compatibility Header" : YES
  • Changed the Project Module Name to Plantasia

  • I’ve cleaned my build folder and tried a bunch of unlikely solutions like #import "Plantasia/Plantasia-Swift.h" , which don't work either.

  • I’ve tried prepending @objc to class declaration in the .swift file.
  • I’ve tried manually adding another bridging header, and specifying the "Swift Compiler – Code Generation" to my header.
  • I've tested starting from a blank Objective-C project, by creating a Swift file, and referenced it successfully within .m file. This shows that it's at least working normally for me in a clean project

I've been trying for hours, and I think there must be one incorrect setting somewhere that I'm unaware of. I've tried basically most of what I could find on the forums. Any additional ideas of things I should still check? Or is there a way of manually creating this "Plantasia-Swift.h" header file?

SumakuTension
  • 542
  • 1
  • 9
  • 26
  • please post code , or better a demo link – Shehata Gamal Jan 24 '19 at 11:49
  • @Sh_Khan Can do, but the code kind of has a lot of files. Is a link to the github repository also ok? – SumakuTension Jan 24 '19 at 12:02
  • Unless you have Swift compile issues, the `-Swift.h` header should be generated. You can also check the "Objective-C Generated Interface Header Name" (`SWIFT_OBJC_INTERFACE_HEADER_NAME`) to see which header is Swift generating (usually is `$(SWIFT_MODULE_NAME)-Swift.h`) – Cristik Jan 25 '19 at 08:53
  • Alriight thanks! It turned out that it's a bit of a ghost error, and I can build anyway despite of the error. Sometimes it just disappears. Stupid that I didn't try that before. – SumakuTension Jan 25 '19 at 15:04

0 Answers0