Created
April 16, 2021 01:10
-
-
Save roz0n/cad0e98e97e99f29e8f615a21a9172ff to your computer and use it in GitHub Desktop.
Remove Previous ViewController in UINavigationController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fileprivate func removePreviousViewController() { | |
guard let navigationController = self.navigationController else { return } | |
let controllerToRemove = "ConfirmationViewController" | |
var allControllers = navigationController.viewControllers | |
for (index, controller) in allControllers.enumerated() { | |
let name = String(describing: type(of: controller)) | |
if name == controllerToRemove { | |
allControllers.remove(at: index) | |
navigationController.viewControllers = allControllers | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment