简体   繁体   中英

Getting error for declaring swift protocol delegate variable in objective c

Error: Can not find protocol declaration for 'GameDelegate';

//Swift protocol
import AVFoundation
import UIKit;

@objc protocol GameDelegate {
    func lostConnection()
}

Objective C class:

//play.h file
#import "SimpliSafe-Swift.h"

@interface SSStreamManager : NSObject 

@property (assign) id<GameDelegate> delegate

@end

Don't import the Swift generated header into a header file! Replace

#import "SimpliSafe-Swift.h"

With

@protocol GameDelegate;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM