Part 1 - State Drive Nagiation: Overview

Intro What triggered the writing of this post were two things: 1. Prior Experience with State Machine We’ve been using state machine for the past few years to simplify a complex onboarding flow. The complexity of our feature rises from: having too many conditions that determine the correct state having the conditions scattered. Some conditions are known at the time of app launch, some are known at the time of onboarding flow commencing, but some others are only known after user identifies their device to us....

December 3, 2025 · 5 min

Part 2 - State Driven Navigation: Tutorial

💡 Read Part 1 first to understand the concept. This post shows you exactly how to implement it. What We’re Building A simple 3-screen onboarding flow: Account Loader Screen → Loads the user’s account in a loader screen Welcome Screen → user taps “Get Started” Device Identification Screen → user enters their devices CMMac Let’s build this with state-driven navigation, step by step. 1 - States States represent every screen your user can be on:...

December 2, 2025 · 4 min

What does actor reentrancy mean?

If you captured any state before doing some async work in your actor, then by the time your task is resumed, your captured state may be stale. This is what actor reentrancy is about. Because of this, you should avoid capturing things that are subject to change before your task is suspended. Instead, only retrieve values after your task is resumed. The term “reentrant” literally means “able to be entered again....

November 11, 2025 · 4 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

High Level Anatomy of a Camera Capturing Session

I used the following tutorial series from Apple on ‘Capturing and Displaying Photos’. They’re great. Just that it took me a bit to be able to piece together how components from AVFoundation work together. Working with AVFoundation isn’t really the kind where you read documentation and then can piece things together. It’s complicated. You might understand an individual step, but won’t understand when it should be done. There’s just too many components and while it’s not low-level, it’s certainly a different kind of iOS....

August 2, 2025 · 6 min

What Is a Suspension Point In Swift?

A suspension point doesn’t mean the current thread is blocked. Nor it means the current actor is blocked. All it means is that the current task / function is blocked / suspended / waiting for an asynchronous task to finish. @MainActor func foo() async { doA() let b = await doB() doC() } When you get to doB(), then the MainActor / Main Thread are not suspended. Other tasks can be enqueued and executed on the main thread....

July 10, 2025 · 1 min

Live Activities Part 1 - Problem Statement

I recently went on a quest for Live Activities. There’s a ton of gotchas or subtle notes that aren’t clearly mentioned. Think of the series as an unofficial rfc. Intro Example app - wwdc code - docs confusion points I saw Apple’s videos and docs on ActivityKit. They do a decent job of showing you 80% of the API and how Live Activity works. The remaining 20% is an enigma though....

April 16, 2025 · 4 min

Live Activities Part 2 - The missing doc

How do I begin development for Live Activities? Follow Apple’s docs: Add a new† (widget) target to your app. Make sure you select ‘Live Activities’. Add the necessary plist items. Add push notification capability. Only needed if you want to start / update from server. If everything is done from within the app then you don’t need this. Example ‘Clock’ App on iPhone adds timers to your phone without any server interaction....

April 16, 2025 · 5 min

Live Activities Part 3 - Development

Development How can I share classes between widget and app? Models must be shared across targets. App needs the model to manage its lifecycle (start, update, end, handling dismissed / stale activities). Widget needs the model to be able to present it. Each View should only get added to targets that needs them. Your widget must create views based on the models for all Live Activity presentations. Your app may need views if it has an in-app view related to the live activity....

April 16, 2025 · 15 min

Live Activities Part 4 - Debugging

Debugging Notification delivery issues Can you send Live Activity notifications to simulator? Yes. The token created by the simulator works. Just don’t use the simulator for testing application lifecycle behavior or background tasks as a may not properly simulate OS restrictions. Can you drag and drop payloads into the simulator? That didn’t work for me. Timing of ‘Token Registration’ vs ‘Payload Sending’ Make sure the tokens are stored in your servers before sending the payload....

April 16, 2025 · 11 min