7

I have a Swift Cocoa Touch Framework project (we'll call it MySwiftFramework) that has some nifty code in it that I'd like to reference in another project/workspace.

When attempting to reference that framework, I get the following error in the code that references the swift classes of the aforementioned framework:

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

I've checked the auto-generated file: MySwiftFramework.framework/Headers/MySwiftFramework-Swift.h and it includes the auto-generated headers for the swift 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 to work is if I drag MySwiftFramework into the workspace I'm trying to reference it with. Then it will compile, but when I try to archive the app, it archives the project as "Xcode Generic Archive" instead of an "iOS App Archive".

There's got to be a way to reference a swift framework by just embedding the MySwiftFramework.framework file.

Does anyone know what might be causing this error?

jww
  • 97,681
  • 90
  • 411
  • 885
Albert Bori
  • 9,832
  • 10
  • 51
  • 78
  • Did you solve this already? If so, please write down an answer. If not, would following the following guide help: https://www.raywenderlich.com/99386/create-cocoapod-swift ? – Orion Mar 22 '16 at 08:19

0 Answers0