Just in my case i modal present with hero from controller1 to UINavigationController with controller2. So for correct animation i should enable hero for navigationController . But that does not mean i want to make heroTransition delegate of my navigation Controller and does not mean. Its not clear. Usually u should enable hero just for dest view controller.
isEnabled should only enable animation to controller as destination, but it should not change delegate of my navigationController to make it buggy. To control if hero delegates navigation or tabs u should add another field like hero.isHandlingNavigation . For now i have the only way to fix this strange behavior - just comment these lines
ofcourse navigation handling and enabling animation to navigation controller as dest should be controlled with different flags, these behaviours should not be always turned off/on together
var isEnabled: Bool {
get {
return base.transitioningDelegate is HeroTransition
}
set {
guard newValue != isEnabled else { return }
if newValue {
base.transitioningDelegate = Hero.shared
// if let navi = base as? UINavigationController {
// base.previousNavigationDelegate = navi.delegate
// navi.delegate = Hero.shared
// }
// if let tab = base as? UITabBarController {
// base.previousTabBarDelegate = tab.delegate
// tab.delegate = Hero.shared
// }
} else {
base.transitioningDelegate = nil
// if let navi = base as? UINavigationController, navi.delegate is HeroTransition {
// navi.delegate = base.previousNavigationDelegate
// }
// if let tab = base as? UITabBarController, tab.delegate is HeroTransition {
// tab.delegate = base.previousTabBarDelegate
// }
}
}
}
Just in my case i modal present with hero from controller1 to UINavigationController with controller2. So for correct animation i should enable hero for navigationController . But that does not mean i want to make heroTransition delegate of my navigation Controller and does not mean. Its not clear. Usually u should enable hero just for dest view controller. isEnabled should only enable animation to controller as destination, but it should not change delegate of my navigationController to make it buggy. To control if hero delegates navigation or tabs u should add another field like hero.isHandlingNavigation . For now i have the only way to fix this strange behavior - just comment these lines
ofcourse navigation handling and enabling animation to navigation controller as dest should be controlled with different flags, these behaviours should not be always turned off/on together