Objective c 我将如何实现委托以将值从子swift类传递到父目标C类?
我试图将值从swift类传递到目标C类,但无法从目标类识别在swift类中创建的委托 swift等级:Objective c 我将如何实现委托以将值从子swift类传递到父目标C类?,objective-c,swift,delegates,Objective C,Swift,Delegates,我试图将值从swift类传递到目标C类,但无法从目标类识别在swift类中创建的委托 swift等级: protocol ChildViewControllerDelegate { func childViewControllerResponse(parameter) } class ChildViewController:UIViewController { var delegate: ChildViewControllerDelegate? } 目标C类: #import "Proje
protocol ChildViewControllerDelegate
{
func childViewControllerResponse(parameter)
}
class ChildViewController:UIViewController
{
var delegate: ChildViewControllerDelegate?
}
目标C类:
#import "Project-Swift.h"
@interface MainViewController()<ChildViewControllerDelegate>
{
// Define Delegate Method
func childViewControllerResponse(parameter)
{
}
}
#导入“Project Swift.h”
@接口MainViewController()
{
//定义委托方法
func childViewControllerResponse(参数)
{
}
}
目标C类无法检测委托。我将如何解决这个问题或我做错了什么?使用
@objc
使儿童视图控制器远程门对Objective-C可见,即
根据需要更改参数
类型
@objc protocol ChildViewControllerDelegate {
func childViewControllerResponse(parameter: String)
}