0

I am able to access swift function in Objective c classes i.e. "*.m" file using suggestion given in Importing Project-Swift.h into a Objective-C class...file not found.

I want to use cpp function in objectvie c class file. To do so I have converted ".m" file to ".mm" . Now I am facing issue to access swift classes in .mm file. I am getting "Cannot find interface declaration for 'UIResponder', superclass of 'AppDelegate'" error for all swift classes in "Project-swift.h" file. please check attachment : enter image description here Anyone has any solution for accessing cpp file and swift class in objective c file?

RohitK
  • 1,444
  • 1
  • 14
  • 37
  • You don't have to convert all .m files to .mm. Could you please add an example of a C++ function that you want to use in Objective-C? – Roman Podymov Feb 12 '20 at 09:59
  • e.g. std::shared_ptr of cpp i want to use in objectiveC code. And from Objective c class i want to access swift functions – RohitK Feb 12 '20 at 10:17
  • Do you want to declare an Objective-C class with a `std::shared_ptr` property? – Roman Podymov Feb 12 '20 at 12:28
  • Well, at least on simple project I did not see any problems. Probably it depends on order... I created main iOS single view Objective-C project, added Swift file, so converted into bridged environment, created simple Swift class, integrated it in AppDelegate.m, build & run, then renamed AppDelegate.m into .mm, added cpp code in one line with swift call, build & run. Everything is ok. – Asperi Feb 12 '20 at 19:37

0 Answers0