1

I have a swift class inside a Objc framework and when i try to use this universal framework inside my project it all works fine with a real device but as soon as i switch to simulator i get this error : 'swiftclass' is unavailable: cannot find Swift declaration for this class where swiftclass is my swift class inside the objc framework. I have checked similar post but nothing which talks about swift class inside objc framework. Also the moment i comment out this swift class useage in my project it again starts building fine with simulator as well.

Max
  • 5,380
  • 6
  • 42
  • 66
  • You mean you mix objc and swift in a framework? – MatthewLuiHK May 30 '18 at 10:22
  • Yes, thats right a Objc framework which has a some new swift classes. As soon as i try building on device i see that my import "swiftmodulename" starts appearing in the framework header if I choose simulator the the import "swiftmodulename" just disappears from the framework header file and thats the reason my swift class is unavailable – Max May 30 '18 at 10:53

2 Answers2

0

I had the exact same error and turned out that I had built my framework for a specific simulator. I changed the device to Generic iOS device and did a clean and build, then I used the generated .framework file. Everything worked just fine after using this generated .framework file.

Moin Shirazi
  • 4,372
  • 2
  • 26
  • 38
0

It was the script which was causing the issue. I just had to make sure that my .framework/Modules/frameworkname.swiftmodule contains both arm64 and x86_64 files. In my case it was create another folder within it which never referred the x86_64 files.

Max
  • 5,380
  • 6
  • 42
  • 66