I have a Navigation Controller with a View Controller displaying a button. The button is linked to another View Controller using a push segue which automatically adds a top navi
If NavViewController is used with UIModalPresentationFullScreen then the below line will work
self.navigationController?.dismiss(animated: true, completion: nil)