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.

3
  • Target > Build Setting > Defines Module to YES try this Commented Mar 9, 2017 at 11:38
  • It is defined as Yes by default Commented Mar 9, 2017 at 11:41
  • what is the value of Architectures (not Valid Architectures) ? Commented Mar 9, 2017 at 12:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.