This demo application shows you:
- how to setup a database in an iOS app
- how to define a simple Codable Record
- how to track database changes and animate a table view with ValueObservation.
Files of interest:
-
AppDelegate
creates, on application startup, a unique instance of DatabaseQueue available for the whole application. -
AppDatabase
defines the database for the whole application. It uses DatabaseMigrator in order to setup the database schema. -
Player
is a Record type, able to read and write in the database. It conforms to the standard Codable protocol in order to gain all advantages of Codable Records. -
PlayersViewController
displays a list of players. It keeps its view up-to-date with ValueObservation. -
PlayerEditionViewController.swift
PlayerEditionViewController
can create or edit a player, and save it in the database.