I am creating alert from trailing swipe in a tableview. On clicking Edit, i am trying to instantiate another view controller and show it as a popup.
The problem is that Popup is either showing in the same screen or when it shows as a popup is missing the navigation bar.
I looked into different threads on stackoverflow but couldn't find a solution.
On a different screen, this works perfectly when i set up the view controller to show as a popup from the storyboard but i can't figure out how to get this to work from inside Alert.
I added the core part of the code that doesn't work. Happy to add any other details you need to look into this.
What I tried so far :
1) Setup presentation style for the vc
vc.modalPresentationStyle = .popover
2) Try a transition -- This displays the vc in the same window
            let transition = CATransition()
            transition.duration = 0.5
            transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
            transition.type = CATransitionType.reveal
            transition.subtype = CATransitionSubtype.fromTop
            self.navigationController?.view.layer.add(transition, forKey: nil)
            self.navigationController?.pushViewController(vc, animated: false)
3) Result is same as #2
self.navigationController?.present(vc, animated: false)
4) Self.Present without the navigation controller.
let modifyAction = UIContextualAction(style: .normal, title:  "Manage", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
            print("Update action ...")
            let alert = UIAlertController()
            alert.addAction(UIAlertAction(title: "Edit", style: .default , handler:{ (UIAlertAction)in
                    print("User click Edit button")
                let vc = self.storyboard?.instantiateViewController(withIdentifier: "ManageCategoryViewController") as! ManageCategoryViewController
                vc.selectedIdx = indexPath.row
                vc.categoryListArray = self.categoryListArray
                vc.type = "update"
                //vc.modalPresentationStyle = .popover
                /*
                let transition = CATransition()
                transition.duration = 0.5
                transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
                transition.type = CATransitionType.reveal
                transition.subtype = CATransitionSubtype.fromTop
                self.navigationController?.view.layer.add(transition, forKey: nil)
                self.navigationController?.pushViewController(vc, animated: false)
                */
                self.navigationController?.present(vc, animated: false)
            }))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler:{ (UIAlertAction)in
                print("User click Cancel button")
            }))
            self.present(alert, animated: true, completion: {
                print("completion block")
            })
