我必须在我的协调器代码中使用 NavigationController 吗?

Do I have to use NavigationController in my coordinators code?

我正在重构我的代码,想试试 Coordinators。

但是,我不太喜欢 UINavigationController 负责,因为它在子坐标上创建了一个后退按钮以及一个我不想要的不需要的顶部栏。

我可以用普通的 UIViewController 代替 UINavigationController 吗?

P.S :这是我在 [Here][1]

中找到的示例代码

协议协调员{ 功能开始() }

协议流可协调{ 变量协调器:FlowACoordinator }

class FlowACoordinator:协调器{

private var navigationController: UINavigationController

private var firstVC: FirstViewController
private var secondVC: SecondViewController

init(navigationController: UINavigationController) {
    self.navigationController = navigationController
}

func start() { ... }

func present(_ viewController: (FlowACoordinatable & UIViewController)) {
    viewController.coordinator = self
    self.navigationController.pushViewController(viewController, animated: true)
}

...

}

class FirstViewController: UIViewController, FlowACoordinatable {

var coordinator: FlowACoordinator?

func buttonTapped() {
    self.coordinator?.goToNextStep()
}

}

回答我自己的问题...

协调器架构基于 UINavigationController 并且 不能 替换为 UIViewController

但是,仍然可以使用 Object Inspection 并选中 Hide buttom bar... 隐藏按钮栏窗格,或者执行它 .