This demo application uses Action, RxDataSources, RxGRDB, and RxSwift to synchronize its view with the content of the database.
To play with it:
- Download the RxGRDB repository
- Run
pod install
- Open
RxGRDB.xcworkspace
at the root of the repository - Run the RxGRDBDemo application.
The rows of the players table view animate as you change the players ordering, delete all players, or refresh them (refreshing applies random transformations to the database)
-
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.
struct Player: Codable, Equatable { var id: Int64? var name: String var score: Int }
-
Players defines read and write operations on the players database.
-
PlayersViewModel defines the content displayed on screen, and a bunch of available actions of players.
-
PlayersViewController feeds from PlayersViewModel and displays it on screen.