5

I have an Swift Framework which works perfectly inside Swift Projects. Now I am trying to use it inside of Objective-C project.

Iv'e Change the Class to looks like:

@objc public class Test : NSObject {}

I imported the framework to the Objective-C project, added it to the Embedded Binaries and to the Linked Frameworks and Libraries.

In the ViewController.m I imported the framework like this:

#import <SwiftFramework/SwiftFramework-Swift.h>

And I try to create instance of type Test:

Test* test = [[Test alloc] init];

Test is recognize but when I try to build it to iPhone it's failed with the reason of:

Undefined symbols for architecture arm64: "_OBJC_CLASS_$__TtC14SwiftFramework4Test", referenced from:

And if I build it to a simulator it failed with the reason of:

Undefined symbols for architecture i386: "_OBJC_CLASS_$__TtC14SwiftFramework4Test", referenced from:

I've tried to add the i386 and arm64 to the Valid Architectures,

I've tried to change the Build Active Architecture Only to No.

I've found a lot of solution which did not help me solve the issue.

I'll appreciate any help, Thank you.

SOLVED:

Build Setting -> Build Settings -> Always Embed Swift Standard Libraries -> YES

I updated the framework and the Objective-C project.

Yanay Hollander
  • 327
  • 1
  • 5
  • 19

0 Answers0