1

Xcode Workflow Preview

8:20FreeDone
2

Start Designing in Xcode

3:46FreeDone
3

Navigation Controllers and Prototyping

3:04FreeDone
4

Designing The Home Screen

3:14FreeDone
5

Creating Custom Classes

4:52FreeDone
6

Customizing The TableView

4:37FreeDone
7

Adding Logic To The Styling

3:29FreeDone
8

Custom Fonts

6:58FreeDone
9

Saving Variables and Triggering Alerts

6:40FreeDone
10

Integrating Pods In Your Xcode Project

2:24FreeDone
11

Recognizing Gestures on UI Elements

3:26FreeDone
12

Retrieving Data From an API

6:56FreeDone
13

Implementing a Custom Loading Animation

4:34FreeDone
14

Saving and Persisting User Data

3:11FreeDone

Encoding and Saving Complex Data

3:35FreeDone
16

Make UI Updates More Granular

2:22FreeDone
17

Refactoring Saved Locations

6:11FreeDone
18

Fine-Tuning TableView Interactions

2:29FreeDone
19

Comparing Custom Classes

3:42FreeDone
20

Make a Custom Popup UI

4:26FreeDone
21

Adding Actions to TableView Cells

3:27FreeDone

Encoding and Saving Complex Data

Published by Chris Slowik

Episode Notes

Extra tips from the author

NSCoding Protocol

The NSCoding protocol enables complex data types to be serialized for archival in a file or UserDefaults. In this lesson we'll be creating a new SavedLocation class which will let us save a location name as well as GPS coordinates - a requirement if we want to use our list later to look up weather values for saved locations.

SavedLocation Class Reference

import CoreLocation
class SavedLocation: NSObject, NSCoding {
    var name: String
    var location: CLLocation
    init(theName: String, theLocation: CLLocation) {
        name = theName
        location = theLocation
    }
    //MARK: - NSCoding
    convenience required init?(coder aDecoder: NSCoder) {
        let decodedName = aDecoder.decodeObject(forKey: "name") as! String
        let decodedLocation = aDecoder.decodeObject(forKey: "location") as! CLLocation
        self.init(theName: decodedName, theLocation: decodedLocation)
    }
    func encode(with aCoder: NSCoder) {
        aCoder.encode(name, forKey: "name")
        aCoder.encode(location, forKey: "location")
    }
}
Episode Topics: