To remove unwanted controller from your iOS navigation history you can use the following example.
extension UIViewController {
public func cleanUnwatedPreviousViewControllers() {
guard let navigation = self.navigationController else {
return
}
let viewControllers = navigation.viewControllers
.filter { !($0 is NewCustomerViewController) }
navigation.viewControllers = viewControllers
}
}
This will remove NewCustomerViewController from history, you can add more in a or condition.