@@ -135,12 +135,7 @@ extension UINavigationController: RuntimeAssociation {
135135 _ transition: AnyNavigationTransition ,
136136 interactivity: AnyNavigationTransition . Interactivity = . default
137137 ) {
138- // fix for https://stackoverflow.com/q/73753796/1922543
139- swizzle (
140- UINavigationController . self,
141- #selector( UINavigationController . popToViewController) ,
142- #selector( UINavigationController . popToViewController_forceAnimated)
143- )
138+ backDeploy96852321 ( )
144139
145140 if defaultDelegate == nil {
146141 defaultDelegate = delegate
@@ -193,6 +188,28 @@ extension UINavigationController: RuntimeAssociation {
193188 #endif
194189 }
195190
191+ private func backDeploy96852321( ) {
192+ func forceAnimatedPopToViewController( ) {
193+ swizzle (
194+ UINavigationController . self,
195+ #selector( UINavigationController . popToViewController) ,
196+ #selector( UINavigationController . popToViewController_forceAnimated)
197+ )
198+ }
199+
200+ if #available( iOS 16 . 2 , macCatalyst 16 . 2 , tvOS 16 . 2 , * ) { } else {
201+ #if targetEnvironment(macCatalyst)
202+ let major = ProcessInfo . processInfo. operatingSystemVersion. majorVersion
203+ let minor = ProcessInfo . processInfo. operatingSystemVersion. minorVersion
204+ if ( major, minor) < ( 13 , 1 ) {
205+ forceAnimatedPopToViewController ( )
206+ }
207+ #else
208+ forceAnimatedPopToViewController ( )
209+ #endif
210+ }
211+ }
212+
196213 @available ( tvOS, unavailable)
197214 private func exclusivelyEnableGestureRecognizer( _ gestureRecognizer: UIPanGestureRecognizer ? ) {
198215 for recognizer in [ defaultEdgePanRecognizer!, defaultPanRecognizer!, edgePanRecognizer!, panRecognizer!] {
@@ -206,8 +223,7 @@ extension UINavigationController: RuntimeAssociation {
206223}
207224
208225extension UINavigationController {
209- @objc func popToViewController_forceAnimated( _ viewController: UIViewController , animated: Bool ) -> [ UIViewController ] ? {
210- // TODO: `if #unavailable(iOS 17?...)` when fixed by Apple
226+ @objc fileprivate func popToViewController_forceAnimated( _ viewController: UIViewController , animated: Bool ) -> [ UIViewController ] ? {
211227 popToViewController_forceAnimated ( viewController, animated: true )
212228 }
213229}
0 commit comments