From 9547bd291384d846b9348da2b3d1bf379b2a5a38 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 22 Aug 2024 12:08:43 -0400 Subject: [PATCH] Fix incorrect split nav layout when closing split with new sidebar --- .../Utilities/SplitNavigationController.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Tusker/Screens/Utilities/SplitNavigationController.swift b/Tusker/Screens/Utilities/SplitNavigationController.swift index 63e8433c60..28200572e9 100644 --- a/Tusker/Screens/Utilities/SplitNavigationController.swift +++ b/Tusker/Screens/Utilities/SplitNavigationController.swift @@ -241,13 +241,19 @@ class SplitNavigationController: UIViewController { // otherwise the secondary nav's contents disappear immediately, rather than sliding off-screen let animator = UIViewPropertyAnimator(duration: 0.35, curve: .easeInOut) { self.isLayingOutForAnimation = true - self.setSecondaryVisible(false) + NSLayoutConstraint.deactivate(self.constraints) + self.constraints = [ + self.rootNav.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: self.rootNav.view.bounds.minX), + self.rootNav.view.trailingAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.trailingAnchor), + self.secondaryNav.view.widthAnchor.constraint(equalToConstant: self.secondaryNav.view.bounds.width), + ] + NSLayoutConstraint.activate(self.constraints) self.view.layoutIfNeeded() } animator.addCompletion { _ in - self.secondaryNav.viewControllers = [] self.isLayingOutForAnimation = false -// self.updateSecondaryNavVisibility() + self.secondaryNav.viewControllers = [] + self.updateSecondaryNavVisibility() } animator.startAnimation() } else {