Git Product home page Git Product logo

playlist's Introduction

PlaylistCodable is designed to introduce students to the codable protocol.

Look over the README in the root folder of this repository

Suggested breakdown for PlaylistCodable

Start this project from Playlist (the version without persistence), not from scratch

  1. Show students the final product first so they know what they are working toward.
  2. Take a few minutes to go over the version without persistence and make sure everyone understands things like prepare(for segue: UIStoryboardSegue, sender: Any?).
  3. Briefly talk about persisting data in general. Why an app would need it and some of the options we have for persisting data. Talk about the idea that most of the time you cannot store your custom objects "as-is". Explain how Codable solves this issue.
  4. Explain that for this project we will be saving our data locally. Write a function called fileURL() which returns the url we will be saving our data to.
  5. Plan out the new methods you will need to store and load data. (saveToPersistentStore(), loadFromPersistentStore())
  6. Fill out your saveToPersistentStore() function using a JSONEncoder. (Make sure you print out the data created by the encoder as string so that the students can see the json that is being created to hold the properties of the model objects)
  7. Determine where in the project you need to call saveToPersistentStore() and add the call(s). Explain why we don't actually need a deleteFromPersistentStore() function. How calling save at the right time instead will actually update the persistent store correctly.
  8. Fill out your loadFromPersistentStore() function using a JSONDecoder.
  9. Determine where in the project to load your data, and call loadFromPersistentStore(). Everyone's app should work now.

playlist's People

Contributors

swoop12 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.