Revert "Fix bug in which teardowns can be called multiple times on the same coordinator"

This reverts commit 4ae3b3b2dba033d560fe5321686635c96bd53f95.
This commit is contained in:
Stefan Ceriu
2023-02-28 19:41:02 +02:00
committed by Stefan Ceriu
parent 802279d8af
commit ee2d770579
@@ -229,13 +229,15 @@ class NavigationSplitCoordinator: CoordinatorProtocol, ObservableObject, CustomS
/// ///
/// For added complexity, the NavigationSplitCoordinator has an internal compact layout NavigationStack for which we need to manually nil things again /// For added complexity, the NavigationSplitCoordinator has an internal compact layout NavigationStack for which we need to manually nil things again
private func releaseAllCoordinatorReferences() { private func releaseAllCoordinatorReferences() {
sidebarModule = nil sidebarModule?.tearDown()
detailModule = nil detailModule?.tearDown()
sheetModule = nil sheetModule?.tearDown()
fullScreenCoverModule = nil fullScreenCoverModule?.tearDown()
compactLayoutRootModule = nil compactLayoutRootModule?.tearDown()
compactLayoutStackModules.removeAll() compactLayoutStackModules.forEach { module in
module.tearDown()
}
} }
private func logPresentationChange(_ change: String, _ module: NavigationModule) { private func logPresentationChange(_ change: String, _ module: NavigationModule) {
@@ -624,10 +626,13 @@ class NavigationStackCoordinator: ObservableObject, CoordinatorProtocol, CustomS
/// when a NavigationModule is dismissed. As the NavigationModule is just a wrapper multiple instances of it continuing living is of no consequence /// when a NavigationModule is dismissed. As the NavigationModule is just a wrapper multiple instances of it continuing living is of no consequence
/// https://stackoverflow.com/questions/73885353/found-a-strange-behaviour-of-state-when-combined-to-the-new-navigation-stack/ /// https://stackoverflow.com/questions/73885353/found-a-strange-behaviour-of-state-when-combined-to-the-new-navigation-stack/
func stop() { func stop() {
rootModule = nil rootModule?.tearDown()
sheetModule = nil sheetModule?.tearDown()
fullScreenCoverModule = nil fullScreenCoverModule?.tearDown()
stackModules.removeAll()
stackModules.forEach { module in
module.tearDown()
}
} }
// MARK: - CustomStringConvertible // MARK: - CustomStringConvertible