Christian Christian - 1 year ago 160
Swift Question

Programmatically go back to previous ViewController in Swift

I send the user over to a page on a button click. This page is a UITableViewController.

Now if the user taps on a cell, I would like to push him back to the previous page.

I thought about something like

but this seems to be a bad idea.

What is the correct way to do it?

Answer Source

If you want to go back to the previous view controller


If you want to go back to the root view controller

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download