简体   繁体   English

在 Objective-c 中使用 swift 类

[英]Use swift classes in Objective-c

I'm working with obj-C app, I need to integrate Clover Payment which are swift protocols.我正在使用 obj-C 应用程序,我需要集成 Clover Payment,它们是 swift 协议。 I have installed clover pods from https://github.com/clover/remote-pay-ios我已经从https://github.com/clover/remote-pay-ios安装了三叶草豆荚

how to use swift protocols in obj-C?如何在 obj-C 中使用 swift 协议? I have done this:我已经这样做了:

In obj-C .h file在 obj-C .h 文件中

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

In obj-C .m file在 obj-C .m 文件中

    #import "ProjectName-Swift.h"

In ICloverConnector.swift在 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 ?我如何从 Obj-C 类中调用这两个函数?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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