Black Friday — Promotion
Ends in ::
Get complete and immediate access to a Pro Yearly subscription with all benefits for just $399 for your first year — or lock in for two years for $599
This is part of the iOS Data and Networking learning path. View Path.
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.
- 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
Part 1: Files & Data
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.
Data & Data Types
Learn about Foundation Data and the term “Data”. Also, famirialize 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.
TYou 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!
Part 2: JSON
Let’s review 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.
Try to use the knowledge from the previous video to now load, or decode via JSONDecoder, an array of JSON data.
Saving On Device
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.
Part 3: 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 video.
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.