Question: I have encountered this warning:

> 
> pushViewController:animated: called on while an existing transition or presentation is
>  occurring; the navigation stack will not be updated.
> 
> 
> 

While trying to call `navigationController?.popViewControllerAnimated(false)` from `UIAlertController` completion block.

Answer: 
Add the code of navigate controller on the ok action button handler. When Tap on ok button navigate the view controller 

```
let okActionBtn = UIAlertAction(title: "Ok", style: .default, handler: {
      self.navigationController?.popViewController(animated: true)
})
let cancelActionBtn = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert)
alert.addAction(okActionBtn)
alert.addAction(cancelActionBtn)
self.present(alert, animated: true)

```
Anyone needs go back to **PreviousVC** Use this code. **Swift5**

```
    dismiss(animated: true) {
        // If you need call someFunction()
        self.someFunction()
        self.navigationController?.popViewController(animated: true)
    }

```