objective-c - 如何在 swift 类中实现目标 C 协议?
问题描述
@protocol LibraryPaymentStatusProtocol <NSObject>
@required
-(void)paymentStatus:(NSString*)message;
@optional
-(void)onError:(NSException *)exception;
-(void)tryAgain;
-(void)cancelTransaction;
@end
我想在我的 swift 类中实现这个协议。该协议存在于库内的 BDViewController.h 文件中。我在我的 swift 项目中成功导入了该库,但无法访问此协议。我还缺少什么?提前致谢。
在我的 Swift 类中,我只想像下面的普通协议一样实现
class mainTabViewController: LibraryPaymentStatusProtocol {
// MARK : - Payment status protocol method
func paymentStatus(_ message: String!) {
}
}
解决方案
推荐阅读
- javascript - 在 ExtJs4 中重命名组件的路径
- vue.js - 如何在 Vue 3 中使用 SSR
- orbeon - Orbeon 表单 - 重复部分字段验证
- c# - 泛型类型的无用装箱
- python-3.x - 如何在 python schedule 模块中完成之前清除挂起的作业?
- angular - 角度错误:“mat-form-field”不是已知元素”
- spring - 如何使用数据源动态初始化 QueryDSL SQL 模板
- javascript - 如何用textarea更改段落
- c - 如何在链表中正确执行弹出功能?
- elasticsearch - 如何在elasticsearch中索引和查询字典数据类型?