UserDefaults in Swift is a class that provides an interface to save key-value pairs in a user’s stored database.
You can use it to save values that are instances of property lists, like NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary.
In this article, I’ll give you a brief introduction on how UserDefaults works and guide you in the creation of a Singleton class, that will manage all the UserDefaults’ related operations in your iOS application.
UserDefaults are mostly used to save app settings or user’s preferences.
UserDefaults has two types of methods that will allow you to store values persistently…
SharedPreferences is an interface used for accessing and modifying preference data in Android.
It handles objects that point to a file containing key-value pairs and provides some methods to read and write them.
You can use SharedPreferences to store primitive types (Int, Float, Long, Boolean, String, and Set of Strings).
In this article, I’ll show you how to implement a simple Kotlin class that will allow you to manage SharedPreferences easily across your Android application.
First, create a file called Prefs.kt in your project directory and declare a class constructor in it, receiving a Context as a parameter. …
Just a regular guy who loves to code and learn. Mobile & web developer from Italy.