I am trying to import a Swift protocol named AnalyticProtocol into an Objective-C class named AnalyticFactory .
protocol AnalyticProtocol { }
I start with an existing Objective-C project (I did not create a new Swift project with xCode, and I did not find how to configure my Objective-C project as a Swift project in xCode 6 ).
In my Swift file, I included a .h file called MyProjectName-Swift.h , but the compiler returned an error telling me that it does not exist . So I created a .h file called MyProjectName-Swift.h , which is actually empty (I don't know what I should put inside).
In the Apple documentation , they said that I should include my .h file named MyProjectName-Swift.h in my .m file. But I need to include it not in my .m file, but in my .h . Could this be problematic?
When I try to compile, I have this error:: 0: error: xxxAnalyticFactory.h: 39: cannot find the protocol declaration for "AnalyticProtocol"
And the incriminated code:
@interface AnalyticFactory : NSObject { Class<AnalyticProtocol> _analyticProtocolClass; // The type of the analytic class currently used. }
I think I don’t understand how I can import the Swift protocol into the Objective-C class.
Does anyone see a mistake in what I'm doing?
objective-c swift
Jean Lebrument Jun 06 '14 at 9:15 a.m. 2014-06-06 09:15
source share