Adding a related or embedded Swift Framework: "MyClass" is unavailable: cannot find Swift declaration for this class

I have a Swift Cocoa Touch Framework project (we will call it MySwiftFramework ) in which there is some excellent code that I would like to reference in another project / workspace.

When I try to reference this structure, I get the following error in the code that refers to the fast classes of the above structure:

"MySwiftClass" is not available: cannot find Swift declaration for this class

I checked the automatically generated file: MySwiftFramework.framework/Headers/MySwiftFramework-Swift.h and includes the automatically generated headers for the quick classes in MySwiftFramework :

 SWIFT_CLASS("_TtC16MySwiftFramework12MySwiftClass") @interface MySwiftClass : NSObject @property (nonatomic, copy) NSString * coolThingName; - (instancetype)init OBJC_DESIGNATED_INITIALIZER; @end 

The only way I can get it working is if I drag MySwiftFramework to the workspace I'm trying to reference. It then compiles, but when I try to archive the application, it archives the project as “Xcode Generic Archive” instead of “iOS Application Archive”.

There should be a way to reference the quick structure by simply pasting the MySwiftFramework.framework file.

Does anyone know what might cause this error?

+6
source share

Source: https://habr.com/ru/post/979985/


All Articles