2

I'm trying to import a Swift class from my framework MyFramework in my unit test code:

In my Objective-C test file, I do:

@import MyFramework;

This line causes a compilation error:

Include of non-modular header inside framework module 'MyFramework': 'src/core-ios/MyFramework/Classes/MyFramework-Bridging-Header.h'

inside the "MyFramework-Swift.h" file. In that file, I can see a plain import from

#import "src/core-ios/MyFramework/Classes/MyFramework-Bridging-Header.h"

I'm not sure what to do. My framework "defines" modular headers, but it sound like the problem is that bridging header file which is included with its entire path rather than just doing #import <MyFramework/MyFramework-Bridging-Header.h>.

Any help appreciated!

1 Answer 1

1

While calling swift class in objective c

  1. In Bridging-Header add #import "myClass.h". This is objective c class where you are using swift class.

  2. In myClass.m add #import < yourProjectName_swift.h >

  3. In myClass.h or myClass.m add "@swiftcalss;"

    first or second point may cause to your error.

Sign up to request clarification or add additional context in comments.

Comments

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.