我在斯威夫特文件中声明:斯威夫特协议错误
protocol SocketManagerDelegate {
func webSocketDidReceiveMessage(message:Message)
func socketWasReconnected()
func webSocketDidFailWithError(error:String)
}
import Foundation
import MDWamp
import SSKeychain
@objc(SocketManager)
class SocketManager: NSObject, MDWampClientDelegate{
static let instance = SocketManager()
var delegate:SocketManagerDelegate?
,我想使用的协议在ObjC文件:
#import <Project-Swift.h>
@interface ChatManager() <SocketManagerDelegate>
@end
@implementation ChatManager.........
我得到这个错误:
无法弄清楚这一点。想法?
在我project-swift.h
文件中的变异delegate
是完全无法显示:
SWIFT_CLASS_NAMED("SocketManager")
@interface SocketManager : NSObject <MDWampClientDelegate>
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong)
SocketManager * _Nonnull instance;)
+ (SocketManager * _Nonnull)instance SWIFT_WARN_UNUSED_RESULT;
@property (nonatomic, strong) MDWamp * _Null_unspecified wampConnection;
@property (nonatomic, readonly, copy) NSString * _Nonnull socketUrlSecure;
@property (nonatomic, readonly, copy) NSString * _Nonnull socketUrl;
尝试@objc协议SocketManagerDelegate替换代码:类{} –
@MikeAlter您的解决方案并获得成功。谢谢。添加一个答案,我会接受它。 – Gal
欢迎,添加下面的答案 –