mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
pr suggestions and implemented a simpler way to clear the route, that always brings back to the initial coordinator
This commit is contained in:
@@ -574,6 +574,21 @@ private struct NavigationSplitCoordinatorView: View {
|
||||
}
|
||||
}
|
||||
|
||||
func pop(to coordinator: CoordinatorProtocol, animated: Bool = true) {
|
||||
if rootCoordinator === coordinator {
|
||||
popToRoot(animated: animated)
|
||||
} else if stackCoordinators.contains(where: { $0 === coordinator }) {
|
||||
var transaction = Transaction()
|
||||
transaction.disablesAnimations = !animated
|
||||
|
||||
withTransaction(transaction) {
|
||||
while stackCoordinators.last !== coordinator, !stackCoordinators.isEmpty {
|
||||
_ = stackModules.popLast()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Present a sheet on top of the stack. If this NavigationStackCoordinator is embedded within a NavigationSplitCoordinator
|
||||
/// then the presentation will be proxied to the split
|
||||
/// - Parameters:
|
||||
|
||||
Reference in New Issue
Block a user