There is an updated version of this course available, created for Swift 5.1, iOS 13, Xcode 11. View Latest Version

Saving Data in iOS

Oct 10 2017 · Video Course (1 hr, 3 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.

Version

  • Swift 4, iOS 11, Xcode 9

Files and Data

Introduction

3:21 Free

What is Data, and what does it mean to save it? Find out this action-packed introductory video!

1

The user's document folder is a great place to store data. Where is it located? The File Manager knows!

2

Paths

3:32

Find out what the difference is between a URL and a path, and learn how to create your own useful URLs.

3

In this video you'll combine the two ways you've learned to create URLs. Stick around to the end for a handy tip!

4

Data

4:02 Free

Save some data! Some Foundation Data! When you've got an array of bytes, you can store them with a Data.

5

String

2:50

Convert between bytes, Data instances, and Strings. They're all easily interchangeable when your data bytes represent Strings using your expected encoding.

6

Practice your saving and loading, after converting from String to Data.

7

Images contain a whole lot of data. Let's practice saving it to locations that are more suitable for your app's needs.

8

Write a method to make it easy to retrieve the PNGs that you've saved in your document directory.

9

Conclusion

0:44

Quickly review what core concepts should feel solid by this point. We'll go over what they'll prepare you for, in the next section.

10

JSON and Property Lists

If the previous section was handy for you, this one probably will be as well! This introductory video will let you know how we'll be building on what you learned there.

11

Create your own Codable type, suitable for use with JSON and Property Lists.

12

JSON

2:17

Learn what JSON is, so you'll know what to expect when you use it to save your Encodable types.

13

JSON Demo

4:46 Free

Now you can save an instance of your type, using JSON. Let's see how the JSON representation differs from Swift, before we load it back.

14

Create a Codable array, and see if you can save and load it the same way you can with individual instances.

15

You're sure to build up complex hierarchies of structs, classes, and enums, in your coding journey. Codable's got you covered!

16

Let's get a taste of working with Property Lists before we dive into what they're made of, in the next video.

17

Learn what makes up a Property List. Employ your knowledge of JSON to be able to understand how the formats differ.

18

Examine the files you stored in the Property List challenge. Also, learn about a few encoding options and how they affect what you can save.

19

Conclusion

1:51

Review everything you've learned in this section, and find out where your data saving journey might yet take you!

20

Version history

iOS 13, Swift 5.1, Xcode 11

Oct 1 2020

iOS 12, Swift 4, Xcode 10

Sep 19 2018

iOS 11, Swift 4, Xcode 9 (Selected)

Oct 10 2017

iOS 10, Swift 3, Xcode 8

Apr 4 2017

Nov 24 2015

Contributors

Comments