这是Protocols
:
protocol WireFrameProtocol{
// router for all normal cases
// like showing login page
}
protocol InteractorProtocol{
var wireFrame: WireFrameProtocol? { get set }
}
protocol HomeWireFrameProtocol: WireFrameProtocol{
// home specific routers
}
protocol HomeInteractorProtocol: InteractorProtocol{
var wireFrame: HomeWireFrameProtocol? { get set }
}
class Test: HomeInteractorProtocol{
var wireFrame: HomeWireFrameProtocol?
}
extension Test: InteractorProtocol{
}
WireFrameProtocol
将具有所有路由功能。HomeWireFrameProtocol
将扩展并仅具有一些与家庭相关的路由。测试类继承自HomeInteractorProtocol
,它有一个 var wireFrame: HomeWireFrameProtocol
,再次HomeWireFrameProtocol
扩展WireFrameProtocol
。
是否var wireFrame: HomeWireFrameProtocol
也代表var wireFrame: WireFrameProtocol
?