Yes, you heard that correctly. The router state is written to SQLite by Rust.

Reply to this note

Please Login to reply.

Discussion

SwiftUI re-renders reactively based on changes in this view model, which just receives notifications of any relevant changes to the SQLite database

This is how the database changes are propogated to Swift. sqlite-watcher listens for changes to database tables in Rust, and sends notifications to Swift via Updater::send_update

Strict 1-directional data flow as God intended

Beautifully simple

You write your UI in platform-native options like SwiftUI or Jetpack Compose. You could also write it in React Native or Flutter. But honestly I don't think they are worth it. When the UI is a pure function you can vibe-code it. Your application is written and tested in Rust.

The UI above was a Cursor one-shot based on this TLDraw diagram. Notice how it put the "choose mint" screen in the wrong place. History screen was also broken so commented it out.

Forget React Native and Flutter!

Forgot to post the TLDraw

Reminded me of this

Why SQLite and not a rust native data store like redb ?

Because SQLite is so stable and well-supported. Should I look into redb? Does anything use it in production? Last time I looked it was only Casey Rodarmor using it lol.

For sure its not as battle tested as sqlite but Im playing around with it since its interesting tech. Rodarmor is looking at making a bdk wallet persister with it too.

are all actions written first to the db and then the ui reacts to the db?

Rust process the actions and writes state to DB and UI reacts to notifications of these db changes

sounds reasonable. are other native apps written like web client-server? that’s stupid