I created a small test framework in Swift. My purpose is to use Swift class in Objective-C class. I created a Swift file. And then an Objective-C file. I made sure that the Objective-C header in Build Settings is Test-Swift.h
When I try to import Test-Swift.h in objective-C file, I get an error -
'Test-Swift.h' file not found.
Swift class :
import Foundation
@objc class MyTest: NSObject {
func addTest() {
print("test")
}
}
Objective-C class :
#import "YourTest.h"
#import <Test/Test-Swift.h>
#import "Test-Swift.h" // Error in this line
@implementation YourTest
-(void)testTest {
// This is how I want to use the swift class
MyTest *test = [MyTest new];
[test addTest];
}
@end
Framework header :
#import <UIKit/UIKit.h>
//! Project version number for Test.
FOUNDATION_EXPORT double TestVersionNumber;
//! Project version string for Test.
FOUNDATION_EXPORT const unsigned char TestVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Test/PublicHeader.h>
Build setting (objective-C header) :
I have set Defines Module to Yes
