Part 1 - State Drive Nagiation: Overview

The Problem: Direct View-to-View Navigation Most apps start with views directly pushing to other views: push(to: ViewB()). This seems simple at first, but quickly becomes a maintenance nightmare. View to View Navigation Cons of Direct Navigation Tight coupling: ViewA must know how to create ViewB instance, including all its dependencies Scattered state: App state is spread across multiple viewModels, making state correctness nearly impossible Single responsibility violation: Each view handles both its own logic AND navigation logic Difficult testing: Views own both state and navigation, making isolated unit tests extremely hard Deeplink hell: No centralized place to handle deeplinks—logic gets duplicated everywhere Hard to understand flows: Navigation paths are scattered across the codebase....

December 3, 2025 · 3 min

Systems Design - Pagination

Cursor-Based Pagination: Handling Deletions, Collisions & Secure Cursors Pagination requires subtle implementation for a smooth infinite scroll. In this post I’ll share what I learned while reading on cursor‑based pagination for a real‑time feed – how it differs from the classic offset/limit approach, how it deals with deletions and timestamp collisions, what goes into a cursor (spoiler: it’s not a random token), why you should (or shouldn’t) protect cursors from tampering, what to cache and how to manage stale data....

November 6, 2025 · 13 min

Tree Basics and some Swift helpers for leetcode

I do leetcoding every once a while, but keep forgetting some tree basics. This post here it to help with that. Types of Tree Trees can have multiple children. Or on the special case of binary trees have only two. A binary tree is still different from a binary search tree (BST) where things follow a certain order. Binary search tree For a Binary tree to be a BST, it has to follow the following rules:...

September 11, 2023 · 8 min

The power and expressiveness of Swift ranges

Ranges in swift are super simple to create. Yet they come in various forms. let r1 = 1...3 let r2 = 1..<3 let r3 = ...3 let r4 = 3... let r5 = ..<3 They all have range like characteristics, but have slightly different traits. It’s because they’re actually different types. Different Range Types let r1 = 1...3 // ClosedRange<Int> let r2 = 1..<3 // Range<Int> let r3 = ...3 // PartialRangeThrough<Int> let r4 = 3....

March 10, 2023 · 7 min

Check if Two Strings Are One Edit Away

Question You can edit a string in three different ways: insert, remove or replace a character. Write a function to see if two strings are one or zero edits away. Example like, like --> true (zero edits) like, likes --> true (one edit: remove/insert) like, life --> true (one edit, replace) like, lik --> true (one edit: remove/insert) like, pine --> false (two edits) like, lion --> false (two edits) Strategy For most questions that require you to return true or false, you can reduce the scope of the question by removing noise....

June 15, 2022 · 3 min