Swift Slowly: Day 11

Continuing with learning about persistence tutorial

Section 3: Method to Load Data

Purpose: Show how to load JSON

This section is pretty cut and dry and I look forward to what the rest of the application looks like. I like the fact that the tutorial shows how to load test data during development.

Section 4: Saving Data

Purpose: This is where the user’s data gets stored from one run to the next.

This is my first time seeing a do-catch statement. I other languages, I’ve seen it as a try-catch and it doesn’t have a specific line on which we are trying.

do {
    let outfile = Self.fileURL
    try data.write(to: outfile)
} catch {
    fatalError("Can't write to file")

Section 5: Save and Load

Purpose: Put the finishing touches on the application.

Other than the part where I put “ObservableObject” instead of “ObservedObject”, I think this was a pretty nice tutorial.

Mandaris Moore @mandaris