Skip to content

Commit

Permalink
Fix another iOS 17.1 animation bug (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
davdroman authored Oct 27, 2023
1 parent 651adee commit e930aee
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/NavigationTransitions/NavigationTransition+UIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ extension UINavigationController {
customDelegate.transition = transition
}

swizzle(
UINavigationController.self,
#selector(UINavigationController.setViewControllers),
#selector(UINavigationController.setViewControllers_animateIfNeeded)
)

swizzle(
UINavigationController.self,
#selector(UINavigationController.pushViewController),
Expand Down Expand Up @@ -232,6 +238,14 @@ extension UINavigationController {
}

extension UINavigationController {
@objc private func setViewControllers_animateIfNeeded(_ viewControllers: [UIViewController], animated: Bool) {
if let transitionDelegate = customDelegate {
setViewControllers_animateIfNeeded(viewControllers, animated: transitionDelegate.transition.animation != nil)
} else {
setViewControllers_animateIfNeeded(viewControllers, animated: animated)
}
}

@objc private func pushViewController_animateIfNeeded(_ viewController: UIViewController, animated: Bool) {
if let transitionDelegate = customDelegate {
pushViewController_animateIfNeeded(viewController, animated: transitionDelegate.transition.animation != nil)
Expand Down

0 comments on commit e930aee

Please sign in to comment.