Chapter 18
Working with Database and SwiftData

Learn not to add too many features right away, and get the core idea built and tested.

– Leah Culver

Congratulations on reaching this milestone! By now, you have successfully developed a basic app that allows users to list their favorite restaurants. Up to this point, all the restaurants have been pre-defined in the source code and stored in an array. If you want to add a new restaurant, the simplest approach is to append it to the existing restaurants array.

However, if you follow this method, the new restaurant data will not be permanently saved. Data stored in memory, such as an array, is volatile. Once you quit the app, all the changes will be lost. Therefore, we need to determine a way to persistently store the data.

To access the full version of the book, please get the full copy here. You will also be able to access the full source code of the project.

results matching ""

    No results matching ""