我打电话给我的演讲functon是在我的演讲正在实施的协议中列出,但每当我把它它永远不会走了进去,我怎么用来初始化我的演讲,所以我可以调用接口funcion?
这里是我的视图控制器:
import UIKit
class FirstScreenViewController: UIViewController, MainViewProtocol {
var myPresenter: MainPresenterProtocol?
func outputPresenterFunction() {
print (myPresenter?.presenterProtocolFuncTwo(numOne: 2, numTwo: 4, sucssesMessage: "Made it ?", failMessage: "failed :(" ) ?? "Default landed")
}
}
在我的演讲,我有:
import Foundation
class MainPresenter: MainPresenterProtocol {
var screenViewController: MainViewProtocol?
func presenterProtocolFuncTwo(numOne: Int, numTwo: Int, sucssesMessage: String, failMessage: String) -> String {
print("function is called")
return "presenter function is called sussfuly"
}
}
和我的协议本身:
protocol MainViewProtocol {
func showSmallHeadline(textToShow: String)
func showHeadline(textToShow: String)
}
protocol MainPresenterProtocol {
static func presenterProtocolFuncOne()
func presenterProtocolFuncTwo(numOne: Int, numTwo: Int, sucssesMessage: String, failMessage: String) -> String
func presenterProtocolFucThree () -> Bool
}
每当我打电话presenterProtocolFuncTwo,让我的默认值,并将它好好尝试去里面的功能在我的演讲