Chapter 6. Working with databases and table views


This chapter covers

  • Storing and getting data
  • Using data in table views
  • Navigating view hierarchies
  • Changing data model

You’re nearly done with FlashCards. So far, you have applied modelview-controller (MVC) to design a complex app. Then, you learned how to use Interface Builder to draw views and Xcode to code classes. Finally, you added icons, image buttons, backgrounds, and animations to polish up your app.

Next, you’ll learn how to store and fetch data so you can track results. Then your users can see how they have progressed at learning state capitals.

Keeping track of data in the FlashCards app

The purpose of the FlashCards app is to help people remember facts. Whether you’re trying to learn college football mascots, celebrity couples, dog breeds, or multiplication tables, it won’t matter much if you don’t improve. To help your users know how well they’re doing, you need to keep track of their results.

Deciding what to store

The best way to figure out what information to store is to think about what users will want to see later. If you’re using FlashCards to learn something, you at least want to know how long the game took you and when you played.

Figure 6.1. What to store for a game result

You also want to know how you did on each card for a particular game.

Figure 6.2. What to store for a card result

Introducing Core Data

Fetching and viewing data

Changing your data model

Planning for what’s next