简体   繁体   中英

Use swift classes in Objective-c

I'm working with obj-C app, I need to integrate Clover Payment which are swift protocols. I have installed clover pods from https://github.com/clover/remote-pay-ios

how to use swift protocols in obj-C? I have done this:

In obj-C .h file

    @class ICloverConnector;
    @interface ViewPayment: UIViewController
    {
         ICloverConnector *cc;
    } 

In obj-C .m file

    #import "ProjectName-Swift.h"

In ICloverConnector.swift

public protocol ICloverConnector : AnyObject {
    
     func addCloverConnectorListener(_ cloverConnectorListener:ICloverConnectorListener) -> Void
    
    
    func initializeConnection() -> Void
    
}

How do I call these two functions from Obj-C class ?

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