I'm using the following pod for my SideMenu functionality. Now, if I opened it from XYZ viewController and selected the row which again opens the XYZ viewController, the page is being pushed, but instead, I want the SideMenu to be dismissed, no to push already presented viewController.
Here is the UI:
And here is my didSelectRow code, which is quite clear:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch indexPath.row {
case 0:
let playerVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "mainPage") as? MainViewController
navigationController?.pushViewController(playerVC!, animated: true)
case 1:
let historyVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "historyPage") as? BroadcastsHistoryViewController
navigationController?.pushViewController(historyVC!, animated: true)
case 2:
let sendMessageVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "messagingPage") as? MessaginViewController
navigationController?.pushViewController(sendMessageVC!, animated: true)
case 3:
let settingsVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "settingPage") as? SettingsViewController
navigationController?.pushViewController(settingsVC!, animated: true)
case 4:
let aboutVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "aboutPage") as? AboutAppViewController
navigationController?.pushViewController(aboutVC!, animated: true)
default: break
}
}
So far I've tried to detect the topMost viewController
, get the presentingViewController
property, but had no success. Can anyone help me handle it in a proper way?