Learn how to easily manage UserDefaults in your iOS application

Photo by Joshua Hoehne on Unsplash

Introduction

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 ’ related operations in your iOS application.

are mostly used to save app settings or user’s preferences.

Getting and setting values

has two types of methods that will allow you to store values persistently…


Learn how to use SharedPreferences effectively in your next Android project with these simple tips.

Keys
Keys
Photo by Chunlea Ju on Unsplash

Introduction

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 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 easily across your Android application.

Class structure

First, create a file called in your project directory and declare a class constructor in it, receiving a as a parameter. …

Luca Pizzini

Just a regular guy who loves to code and learn. Mobile & web developer from Italy.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store