QuickBirdEng / XCoordinator

🎌 Powerful navigation library for iOS based on the coordinator pattern
MIT License
2.26k stars 177 forks source link

Error: Please don't set a custom delegate on UINavigationController.interactivePopGestureRecognizer #184

Closed iDevid closed 3 years ago

iDevid commented 4 years ago

Sometimes when I do the back gesture on a Navigation Controller I get this assertion failure, seems that it depends on

           guard let delegate = interactivePopGestureRecognizerDelegate,
                delegate.responds(to: delegateAction) else {
                    // swiftlint:disable:next line_length
                    assertionFailure("Please don't set a custom delegate on \(UINavigationController.self).\(#selector(getter: UINavigationController.interactivePopGestureRecognizer)).")
                    return false
            }

Actually when this happens interactivePopGestureRecognizerDelegate is nil and I didn't set any custom delegate

iDevid commented 4 years ago

Ok seems that the problem is somewhere else, I'm integrating gradually XCoordinator in an huge application, and for various reason I can't put Xcoordinator anywhere right away. So when switching from an XCoordinator context to one without it, this error appears, because when doing it the first NavigationAnimationDelegate will be deallocated, and so navigationController?.interactivePopGestureRecognizer.delegate became nil