There's special unwind segue for that purpose, it is intended to roll back to certain view controller in stack.
Let's call the topmost controller (where you go from) as source and the controller in stack (which you want to roll back to top) as destination.
create IBAction
in destination to be triggered on unwind segue:
@IBAction func myUnwindAction(segue: UIStoryboardSegue) {}
it can be empty.
in source controller create an unwind segue by dragging from the controller icon to exit one, it will find the action you created at the step 1. Call the segue unwind
.
now you can issue that segue from code with regular
performSegueWithIdentifier("unwind", sender: nil)
I described how to issue unwind segue from code. For buttons unwind segues can be created in IB directly by dragging a button to exit icon.
Also check this discussion for more info: How to perform Unwind segue programmatically?