I want to add alertView with done and cancel button but i clicked cell Logout menu at that time my current Viewcontroller popToViewController Login Screen and after show Alert but i need on done button popToViewController my code
override func viewDidLoad() {
super.viewDidLoad()
sideMenuController?.cache(viewControllerGenerator: {
self.storyboard?.instantiateViewController(withIdentifier: "LoginVC")
}, with: "1")
sideMenuController?.delegate = self
}
and below code in didSelectRow
let refreshAlert = UIAlertController(title: GlobalConstants.APPNAME, message: "Are you sure you want to logout?", preferredStyle: UIAlertController.Style.alert)
refreshAlert.addAction(UIAlertAction(title: "Yes", style: .default, handler: { (action: UIAlertAction!) in
print("Handle Ok logic here")
if #available(iOS 13.0, *) {
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyBoard.instantiateViewController(withIdentifier: "LoginVC") as! LoginVC
self.navigationController?.popToViewController(vc, animated: true)
} else {
// Fallback on earlier versions
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyBoard.instantiateViewController(withIdentifier: "LoginVC") as! LoginVC
self.navigationController?.popToViewController(vc, animated: true)
}
}))
refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction!) in
print("Handle Cancel Logic here")
}))
present(refreshAlert, animated: true, completion: nil)
I want to add alertView with done and cancel button but i clicked cell Logout menu at that time my current Viewcontroller popToViewController Login Screen and after show Alert but i need on done button popToViewController my code
and below code in didSelectRow