SideMenuAnimationControllerDelegate assignment nil before delegate call sideMenuAnimationController(_ animationController: SideMenuAnimationController, didDismiss viewController: UIViewController)
WineKai opened this issue · comments
I have read the guidelines for contributing and I understand
and i use the recent release version.
i found the method in class SideMenuAnimationController
line 76:
func animationEnded(_ transitionCompleted: Bool) {
guard let presentedViewController = presentedViewController else { return }
if presentedViewController.isHidden {
delegate?.sideMenuAnimationController(self, didDismiss: presentedViewController) // this place, delegate has assginment nil
} else {
delegate?.sideMenuAnimationController(self, didPresent: presentedViewController)
}
}
when i tap to dismiss.delegate has assignment nil by code:
override open func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// Work-around: if the menu is dismissed without animation the transition logic is never called to restore the
// the view hierarchy leaving the screen black/empty. This is because the transition moves views within a container
// view, but dismissing without animation removes the container view before the original hierarchy is restored.
// This check corrects that.
if isBeingDismissed {
transitionController?.transition(presenting: false, animated: false)
}
// Clear selection on UITableViewControllers when reappearing using custom transitions
if let tableViewController = topViewController as? UITableViewController,
let tableView = tableViewController.tableView,
let indexPaths = tableView.indexPathsForSelectedRows,
tableViewController.clearsSelectionOnViewWillAppear {
indexPaths.forEach { tableView.deselectRow(at: $0, animated: false) }
}
activeDelegate?.sideMenuDidDisappear?(menu: self, animated: animated)
if isBeingDismissed {
transitionController = nil // this place assginment nil
} else if dismissOnPresent {
view.isHidden = true
}
}
in class SideMenuNavigationController
, line 258.
so the delegate cannot callback sideMenuAnimationController(self, didDismiss: presentedViewController).