Post

Replies

Boosts

Views

Activity

Swift class in ObjC Project : "Receiver 'MySwift' for class message is a forward declaration" error even after adding @obj and open prefixes
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 'SocketIOClient' for class message is a forward declarationReceiver type 'SocketIOClient' for instance message is a forward declarationI have already done following :Imported MyProject-Swift.h in the MyObjCClass.m file.Marked the swift class with @objc and openSo, what can be the reason for the issue?
3
0
7.9k
May ’22
Swift class in ObjC Project : "Receiver 'MySwift' for class message is a forward declaration" error even after adding @obj and open prefixes
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 'SocketIOClient' for class message is a forward declarationReceiver type 'SocketIOClient' for instance message is a forward declarationI have already done following :Imported MyProject-Swift.h in the MyObjCClass.m file.Marked the swift class with @objc and openSo, what can be the reason for the issue?
Replies
3
Boosts
0
Views
7.9k
Activity
May ’22