我将如何实现委托以将值从子 swift class 传递给父 objective C class?

How I will implement delegate to pass value from a child swift class to a parent objective C class?

我正在尝试将值从 swift class 传递到 objective C class,但是在 swift class,无法从 objective class.

中识别

swift class:

protocol ChildViewControllerDelegate
{
 func childViewControllerResponse(parameter)
}

class ChildViewController:UIViewController
{
var delegate: ChildViewControllerDelegate?
}

objective C class:

#import "Project-Swift.h"
@interface MainViewController()<ChildViewControllerDelegate>
{

// Define Delegate Method
func childViewControllerResponse(parameter)
{
}

}

Objective C class 无法检测到委托。我将如何解决这个问题或者我做错了什么?

使用@objc使ChildViewControllerDelegateObjective-C可见,即

@objc protocol ChildViewControllerDelegate {
    func childViewControllerResponse(parameter: String)
}

根据您的要求更改 parameter 类型。