У меня есть элемент кнопки правой панели (с использованием SWReveal Controller), и я хочу выйти из системы, используя вид предупреждений, показывающий всплывающие окна «ОК» и «Отмена», если я нажимаю «ОК», это должно означать печать и переходить кна странице, и если я нажимаю «Отмена», она должна оставаться такой же .......
Я получаю ошибки
здесь мой код:
@IBAction func logoutButton(_ sender: Any) {
let alert = UIAlertController(title: "Alert", message: "Are you Sure You want to Logout", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
switch action.style{
case .default:
print("Please Enter Details")
case .cancel:
print("cancel")
case .destructive:
print("destructive")
}}))
self.present(alert, animated: true, completion: nil)
GIDSignIn.sharedInstance().delegate = self
GIDSignIn.sharedInstance().uiDelegate = self
GIDSignIn.sharedInstance().signOut()
let secondViewController = self.storyboard?.instantiateViewController(withIdentifier: "signinpage") as! ViewController
self.navigationController?.pushViewController(secondViewController, animated: true)
alert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { action in
switch action.style{
case .default:
print("Please Enter Details")
case .cancel:
print("cancel")
case .destructive:
print("destructive")
}}))
self.present(alert, animated: true, completion: nil)
let secondViewController2 = self.storyboard?.instantiateViewController(withIdentifier: "HomeViewController") as! HomeViewController
self.navigationController?.pushViewController(secondViewController2, animated: true)
}