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:
- Proper error catching (app won’t crash when errors are thrown!)
- Migration from structs to classes (this is a big one since classes can be passed around as references rather than copies - more details below)
- Add / Remove / Refresh / Back / Forward in tabs + tabs referenced everywhere UUID’s instead of array indices
- Proper implementation of browser delegate methods without ghost tabs (basically solving a longstanding bugs where tabs wouldn’t actually delete when they were closed)
- Fixed bug where Tab #0 always existed but was inaccesible
- Proper URL / search query construction for any search engine (adding support to search web via search bar)
- When tabs close, they actually close!! (used to have a problem that a playing YouTube video would not stop when tab closes)
- Re-engineered Dub Provider just a lil to better format data passed between JS and Swift (this makes it so it can actually be parsed in Swift and not using a million and one optionals)
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:
- Implement Upload/Download functionality
- Implement WalletManager() with wallet connect and EOA wallet support (we’re migrating to a new/better Web3Swift Package, so some work to be done here)
- Implement data persistence and cookie management
- Implement Bookmarks / Homepage
- Implement Search w/ Autofill
- Keyboard Shortcuts
- A fresh, functional UI for dub (owned by Cam / Pavan)
There’s a lot to be done but we’re still riding a strong wave of momentum. Back next week with more ✌️