user10355502
user10355502

Reputation:

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

Upvotes: 0

Views: 47

Answers (1)

matt
matt

Reputation: 534950

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

#import "SimpliSafe-Swift.h"

With

@protocol GameDelegate;

Upvotes: 1

Related Questions