Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bridging Header issue - 'MyClass' is unavailable: cannot find Swift declaration for this class

I have visited this links -

MyClass is unavailable: cannot find Swift declaration for this class - Release Build Only

Adding Linked or Embedded Swift Framework: 'MyClass' is unavailable: cannot find Swift declaration for this class

Swift: using private framework

But none of the above links helped me to solve my problem.

I am developing an App using objective-c, in the app I am integrating ios-charts whose framework is developed in swift.I have merged the project as given in the README file. After integrating i have created a MyClass.swift file and then inherited the MyClass.swift file with a Class which is defined in charts.framework.But this is rising an error

'Class' is unavailable: cannot find Swift declaration for this class

Does anyone help me to solve this error? Any suggestions??

like image 812
Rajat Avatar asked Aug 31 '15 13:08

Rajat


3 Answers

This may be due to possibility that you are building for device and using for simulator and vice-versa. Please check this. This is very important thing. If you compiled or build framework for device, it will not work on simulator.

like image 77
Gopesh Gupta Avatar answered Oct 16 '22 02:10

Gopesh Gupta


My fix for this problem was to change the deployment target of the framework from my device to “Generic iOS Device” and then rebuild the framework.

like image 42
Alan Kinnaman Avatar answered Oct 16 '22 02:10

Alan Kinnaman


Try adding @objc infront of the MyClass declaration (i.e. @objc class MyClass {...})

like image 20
Yaser Avatar answered Oct 16 '22 01:10

Yaser