-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

iOS 17 Programming for Beginners
By :

Currently, when you create a new journal entry using the Add New Journal Entry screen and click the Save button, the entry will appear on the Journal List screen:
Figure 23.1: Simulator showing new entries added to the Journal List screen
If you quit and restart your app, the newly added entries will disappear:
Figure 23.2: Simulator showing new entries disappear after the app is relaunched
This is because the contents of the journalEntries
array are only kept in memory and not saved to device storage when the app is closed. To resolve this, you will implement SwiftData for your app. The first step in implementing SwiftData is to create model objects from your existing JournalEntry
class, modifying this and other classes in your app as needed. Follow these steps:
SwiftData
framework and annotate the...