Persistence: UserDefaults
Spring 2019 & Fall 2019 Additional Topic
Last updated
Spring 2019 & Fall 2019 Additional Topic
Last updated
In short, data persistence is keeping the data you are working with around. This means that the same data can be retrieved without being altered when the user closes and then re-opens the app.
There are several ways to achieve persistence in iOS, including:
UserDefaults
CoreData
CloudKit
UIDocument
In the course, we focus on UserDefaults
, which is used to achieve lightweight persistence, e.g. to store small amounts of data.
Persistence has been an additional topic for a few different semesters, so there's a few demos available!
The following demo introduces SnapKit
alongside using UserDefaults
!
The following demo involves using UserDefaults
with custom classes by conforming the class to Codable
.
The following demo introduces SnapKit
alongside using UserDefaults
!