After spending a few hours to integrate swift files successfully to my Objective-C based iOS project, I face the next challenge now :
- In one of my Objective-C class header (Say, MyObjCClass.h), I do the forward declaration for MySwiftClass.
- In the respective .m file, I define an instance of MySwiftClass _swiftClassInstance.
- In the init method of MyObjCClass, I try to instantiate it as follows :
_swiftClassInstance = [[MySwiftClass alloc] init];
When I compile the code, I get 2 errors:
- Receiver 'MySwiftClass' for class message is a forward declaration
- Receiver type 'MySwiftClass' for instance message is a forward declaration
I have already done following :
- Imported MyProject-Swift.h in the MyObjCClass.m file.
- Marked the swift class with @objc and open
So, what can be the reason for the issue?