Swift is Apple’s proprietary general-purpose programming language, developed as a successor to Objective-C. It’s used to create projects ranging from mobile and desktop apps to cloud hosted apps.
It adds some improvements over Objective-C such as type inference, type safety, performance improvements, and a much more concise language, requiring fewer lines of code.
Because Swift, like Objective-C, was also developed by Apple for their platforms, it gives access to the Foundation framework, providing access to some useful native features that play a role in data persistence:
UserDefaults: This gives the ability to store user- or application-specific default information, such as preferred playback speed or language.
Keychain: This is where secure data is stored, such as passwords and certificates, and will be well-known to iOS developers due to its role in provisioning devices and applications, and for development.
We will discuss some other examples of iOS data persistence that work well with Swift when we discuss database options later in the article.