@@ -135,12 +135,7 @@ extension UINavigationController: RuntimeAssociation {
135
135
_ transition: AnyNavigationTransition ,
136
136
interactivity: AnyNavigationTransition . Interactivity = . default
137
137
) {
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 ( )
144
139
145
140
if defaultDelegate == nil {
146
141
defaultDelegate = delegate
@@ -193,6 +188,28 @@ extension UINavigationController: RuntimeAssociation {
193
188
#endif
194
189
}
195
190
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
+
196
213
@available ( tvOS, unavailable)
197
214
private func exclusivelyEnableGestureRecognizer( _ gestureRecognizer: UIPanGestureRecognizer ? ) {
198
215
for recognizer in [ defaultEdgePanRecognizer!, defaultPanRecognizer!, edgePanRecognizer!, panRecognizer!] {
@@ -206,8 +223,7 @@ extension UINavigationController: RuntimeAssociation {
206
223
}
207
224
208
225
extension 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 ] ? {
211
227
popToViewController_forceAnimated ( viewController, animated: true )
212
228
}
213
229
}
0 commit comments