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

View File

@ -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
private func releaseAllCoordinatorReferences() {
sidebarModule = nil
detailModule = nil
sheetModule = nil
fullScreenCoverModule = nil
sidebarModule?.tearDown()
detailModule?.tearDown()
sheetModule?.tearDown()
fullScreenCoverModule?.tearDown()
compactLayoutRootModule = nil
compactLayoutStackModules.removeAll()
compactLayoutRootModule?.tearDown()
compactLayoutStackModules.forEach { module in
module.tearDown()
}
}
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
/// https://stackoverflow.com/questions/73885353/found-a-strange-behaviour-of-state-when-combined-to-the-new-navigation-stack/
func stop() {
rootModule = nil
sheetModule = nil
fullScreenCoverModule = nil
stackModules.removeAll()
rootModule?.tearDown()
sheetModule?.tearDown()
fullScreenCoverModule?.tearDown()
stackModules.forEach { module in
module.tearDown()
}
}
// MARK: - CustomStringConvertible