No type or protocol named 'xxx' And Command CompileSwift failed with a nonzero exit code

Hi all,
I have a protocol ZPResultHandlerDelegate , which declared in .h Objective c file. And the I have a UIViewcontroller in Swift:

@objcMembers
public class MyViewController: BaseViewController, ZPResultHandlerDelegate {}

But when I run my project, I have error:
No type or protocol named 'ZPResultHandlerDelegate'
Like the image:


In the left side of Xcode project, also have another error message:
Command CompileSwift failed with a nonzero exit code
Please help me. I has searched all solutions, but nothing can help.

You need to forward-declare the protocol in your .h file. Put this on the top:

@protocol ZPResultHandlerDelegate;

Hi @suyashsrijan, I has tried your suggestion, put @protocol ZPResultHandlerDelegate; on the top of the .h file:

@protocol ZPResultHandlerDelegate;
@protocol ZPResultHandlerDelegate <NSObject>

But still got the same error:

Hm. Where is ZPResultHandlerDelegate declared? Is it part of your app's bridging header, or somewhere else?

Ah, is it possible this error is coming when compiling an Objective-C++ file (.mm)? Then it might be this known issue, SR-805.

@jrose I had searched and known this case of error (as your mention). But my case is different.
My ZPResultHandlerDelegate declared at ZPResultHandler.h and this header file had imported into SDKPrivateHelper.h and then I imported SDKPrivateHelper.h into module map:

module SDKObjC {
    header "../SDKPrivateHelper.h"    
    export *
}

Finally into class MyViewController (Swift class), I imported import SDKObjC on the top. But still cannot use ZPResultHandlerDelegate . The error as above.

@nhatlee were you able to resolve this?

Finally, I must write my new class by Objective-C instate of Swift :((