EXPERIMENTS

#029 Dub Rewritining 
    Dupdate
by Anupam, 02/01/23

Download Link

This is short one since there isn’t much to show yet (lots of written code, very little written UI)! No download link, but coming soon :)

Overview

My big goal this week was kicking off the rewrite of Dub.

We’ve spent the past month and a half or so pushing out Dub versions through 0.042; our pace of iteration and release has been so fast that we’ve outpaced our ability to fix bugs!

This was intentional - it allowed us to spend a short amount of time leaping over technical hurdles quickly (minimum viable wallet + minimum viable browser) with spaghettified code & codebases with the knowledge that we were eventually going to reconsolidate (more slowly + intentionally).

Basically - we figured out the hard stuff, now we get to put it all together!

Process

What this meant for my work this week was kicking up a fresh version of Dub and starting the implementation of a modular browser and wallet.

Some of the major accomplishments include:

While some of these took a good amount of time, I am most proud of re-engineering Swift UI to reference classes instead of structs.

In Swifts, struct objects are value types - in other words, when you pass a struct object around (or try to mutate it), you can end up with a copy instead of the actual object. This is bad when you have tabs and want to take actions on them - go back, go forward, etc.. and leads to big memory leak issues.

Because of how Swift UI operates (a diffing algorithm that looks for changes), you normally can’t watch reference types (like a class) in an array for changes. But, with some fun restructuring, cool implementations of Swift UI states, and child views, it works!!

Using classes allows us to actually implement several best code practices and a modular wallet manager (coming soon).

Next Steps

There’s still a little while to go before this rewrite is complete. The plan was to set Dub as our default browser this week - and, while we’re close, we’re honestly not there yet.

The big pending next steps for this next sprint are:

There’s a lot to be done but we’re still riding a strong wave of momentum. Back next week with more ✌️