我的协议不工作,它有什么问题?

My protocol is not working, what is wrong with it?

我有四个视图控制器,我正在尝试通过协议在控制器之间发送数据,尽管我的其他两个协议工作正常,但最后一个不工作,我无法弄清楚。

这是我应该发送数据的第一个视图控制器:

import UIKit

class ExercisesTableViewController: UITableViewController, ExerciseProtocol{

    var exerciseToSend: Exercise? {
        didSet{
            print(exerciseToSend!) // This prints the result.
            performSegue(withIdentifier: "showDetail", sender: self)
        }
    }

    func getExercise() -> Exercise {
        return exerciseToSend!
    }
                   .
                   .
                   .
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        exerciseToSend = exercises[indexPath.row]
    }
                   .
                   .
                   .
}

这是应该接收数据的控制器

import UIKit

protocol ExerciseProtocol {
    func getExercise() -> Exercise
}

class ExerciseDetailViewController: UIViewController {

    var delegate:ExerciseProtocol?

    override func viewDidLoad() {
        print(delegate?.getExercise()) // This doesn't print the result.
        super.viewDidLoad()
    }
}

在里面添加这个 ExercisesTableViewController

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    guard let des = segue.destination as? ExerciseDetailViewController else {return}
    des.delegate = self
}