Class is unavailable: Cannot find swift declaration for this Class

Hi All,


Currently i have created a framework in swift. I have exposed severeal public classes. The


I have 3 framework packages

packageA - APIS (Class A, Class B, Class C, Class D)

packageB - all abstract code is their.

packageC - All configs


packageA dependent on packageB

packageC dependent on packageB


In swift application code.

I am importing packageA, packageC.

For below below statements i am getting compiler error Saying "Class A Class is unavailable: Cannot find swift declaration for this Class".


Class A.testFunc("test")


Class A.testFunc("test2")

If we build these packages for only simulator architectures and integrate with a swift Application. Its all working fine without any compiler errors.

Suppose if i build the above 3 packages including device architectures i am getting a compiler error Saying "Class A Class is unavailable: Cannot find swift declaration for this file".


In all cases Its working if i integrate to an application written in Objective-c application !

Replies

Same here. Did you find any solution?

This is getting really annoying. Spent many days trying to make it work. No advance.

In my case I have Objective C code in the Framework as well and when using the framework I'm able to see the ObjC classes but not the Swift classes.

Also I had one dependency with CocaPods (Mockingjay).

I'm still not sure what settings in the project cocoaPods is changing but what it worked for me was removing cocapods with pod deintegrate and build the project again, then I was able to see my Swift classes.

I was lucky this was the only dependcy I had with cocoapods.


Hope this helps anyone with the same problem.

Hi Guys we found solution for this issue.


Solution is after creating universal binary please do these step.


before lipo , you are building .framework packages for individual architectures. i386, x85_64, armv7, arm64.

For each packages

1.traverse upto abc.framework/Modules/abc.swiftmodule/

2.copy files .swiftdoc and .swiftmodule

3.go into universal abc.framework

4.traverse upto abc.framework/Modules/abc.swiftmodule/

5.paste the files you copied in step 2.


repeat these steps for all architectures.


finally your universal framework package abc.framework/Modules/abc.swiftmodule/ path should contain

below files.

arm.swiftdoc

arm.swiftmodule

arm64.swiftdoc

arm64.swiftmodule

i386.swiftdoc

i386.swiftmodule

x86_64.swiftdoc

x86_64.swiftmodule


swift compiler needs swiftmodule map filese for each architectures.


Thanks

kumar