Construct: D&D companion app in SwiftUI
Project Goals
This project aims to be...
- π an easy to use companion app for Dungeon Masters running 5th edition D&D
- π a resource for developers learning SwiftUI and The Composable Architecture
For Dungeon Masters
The easiest way to use the app is by downloading it from the App Store.
You can find an overview of Construct's features at construct5e.app.
For developers
Download the project, open Construct.xcodeproj
and run Construct
.
Architecture overview
Construct is built using SwiftUI and a reducer-based architecture implemented using The Composable Architecture framework. The entire app's state is represented by the AppState struct, a deeply nested data structure containing the top-level screens and any screen, sheet or popover opened from there. A tight integration between SwiftUI's NavigationLink and the app's state make programmatic navigation a breeze.
All data in the app is stored locally in an sqlite database using GRDB. Construct defines a simple key-value store on top of GRDB. All entities are serialized using Swift's Codable, can optionally support full-text search and are automatically saved in the database when they change in the app state.
The D&D domain calls for some interesting parsing solution. Construct contains a small parser combinator framework and defines a couple of interesting parsers.
I hope to write posts detailing some of the interesting parts of the app in the future.