Saving Data in iOS

Oct 1 2020 · Video Course (1 hr, 41 mins) · Beginner

Find out where and how to save data in iOS! This course explores common methods for persisting user data, all from within Xcode Playgrounds.


  • Swift 5.1, iOS 13, Xcode 11

Files & Data


6:11 Free

Welcome to the Saving Data in iOS course! Find out what you'll learn, including FileManager, the Filesystem, URLs, Foundation Data and data types, and how to save and load data using files.


Familiarize yourself with FileManager and how to use it to retrieve the URL for the existing Document directory.




Learn how to add to a URL’s paths, and customize the files and filenames you use to save data with the URL you acquire.


Practice working with strings and URLs to create a path and filename where data would get stored to.


Learn about Foundation Data and the term “Data”. Also, familiarize yourself with the basics of Swift data types and structures like Integers, Floats, Doubles, Strings, Dictionaries, Sets, and Arrays.


Save and load data from an array into a binary file (without an extension), as well as a file with the .txt extension.




Save an array of integers, representing emoji, and also a string to file. Also, see how you're saving emoji to a text file both as bytes of data, or as string data.


Try to save a string to a file and read it back, this way you'll understand what happens behind the scenes when you use the "write" method on String.




You can now work with the FileManager, the Filesystem, and Data in order to save and load data from files in your app. In this episode, find out what's next!



Check out what you'll be learning in this part of the course, including JSON, its structure and types, saving and loading data using JSON, and Swift's Codable protocol.


Get an overview of JSON, what it means, the data format, and supported data types. Then, learn how to load, or decode, data from a JSON file.


Use the knowledge from the previous episode to load or decode via JSONDecoder, an array of JSON data.


In this episode, find out how to save files on a simulator or physical iOS device. Also, learn about the app bundle.


Save your JSON data to disk. This will mean the app is now loading and saving its data to the app bundle.


This challenge asks you to handle encoding an array of JSON data to a file, as opposed to encoding a single item.


Get a sense of how to encode/decode codable objects within each other. Also learn about CodingKeys and how to handle mapping different JSON properties to your Swift ones.




Let's review where you are with your JSON data-saving core concepts, and discuss what's next.


Property Lists

This part of the course includes learning about Property Lists, how they compare to JSON, and saving and loading data via PList files.


Cover the basics of Property Lists, .plist files, their difference with JSON, and the data types you can store in them.


Take on a challenge to see if you can save your existing JSON data into a property list file instead.


A back-to-back challenge where you attempt to now read back the property list file you saved in the previous episode.


Learn about the differences of working with JSON and Property Lists, pros and cons of each, and when you’d want to consider using them.




Congrats on finishing the course! Where can you take your skills now? Learn about next steps and further resources.


Version history

iOS 15, Swift 5.5, Xcode 13

May 31 2022

iOS 13, Swift 5.1, Xcode 11 (Selected)

Oct 1 2020

iOS 12, Swift 4, Xcode 10

Sep 19 2018

iOS 11, Swift 4, Xcode 9

Oct 10 2017

iOS 10, Swift 3, Xcode 8

Apr 4 2017

Nov 24 2015

Who is this for?

Beginner to intermediate developers. If you're a beginner developer, or if you are following our iOS learning paths, this course will teach you the foundations of saving and loading data in iOS.

This course is also a great guide for intermediate developers who would like to know more about how to work with data, files, the filesystem, and parsing data to/from JSON or Property Lists.

Covered concepts

  • Data: basic concepts
  • Available data types in Swift
  • Files & the Filesystem
  • The app bundle
  • The app sandbox
  • FileManager, URL, and Foundation Data
  • JSON and Property lists formats for storing and serializing data with the Encodable and Decodable protocols
  • How to load and save data in a real-world SwiftUI application