Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@groue @bellebethcooper
51 lines (31 sloc) 2.2 KB

Demo Application

Models

  • AppDatabase.swift

    AppDatabase defines the database for the whole application. It uses DatabaseMigrator in order to setup the database schema, and a DatabasePool for efficient multi-threading.

  • Player.swift

    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 {
        var id: Int64? // Use Int64 for auto-incremented database ids
        var name: String
        var score: Int
    }
  • Players.swift

    Players defines read and write operations on the players database.

    It exposes a publisher of HallOfFame, that changes everytime the database is modified.

    struct HallOfFame {
        /// Total number of players
        var playerCount: Int
        
        /// The best ones
        var bestPlayers: [Player]
    }

User Interface

You can’t perform that action at this time.