Why Not Segue Back?

Your first thought for telling the add/view scene to update may be to segue back. Unfortunately, this does not work. Each segue creates a new view controller. Instead of going back to the same add/view view controller instance that opened the edit scene, you would go to an entirely new view controller with just one car. Even worse, the original edit scene would not be disposed of, and each edit/return cycle would create two more controllers that take up memory.

You can update the add/view scene in at least three ways:

Image Add a currentCarUpdated method to ViewController and a link to the ViewController object in CarEditViewController ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.