Scaffolding

SwiftUI · Swift 6.2 · Macro-powered

Coordinator pattern.
Compile time.

Define routes as functions on an @Observable class. The @Scaffoldable macro generates a type-safe Destinations enum from your methods — no manual cases, no switch statements, no boilerplate.

Scroll
01

Define routes as functions.

HomeCoordinator.swift
@Scaffoldable @Observable
final class HomeCoordinator: @MainActor FlowCoordinatable {
    var stack = FlowStack<HomeCoordinator>(root: .home)

    func home() -> some View { HomeView() }
    func detail(item: Item) -> some View { DetailView(item: item) }
    func settings() -> any Coordinatable { SettingsCoordinator() }
}
02

Push and present, separately.

route(to:) only pushes. present(_:as:) handles sheets and full-screen covers — and is available on every coordinator type.

Navigation
// Push onto the stack — type-safe destination.
coordinator.route(to: .detail(item: planet))

// Present a modal — sheet or full-screen cover.
coordinator.present(.settings, as: .sheet)
coordinator.present(.login, as: .fullScreenCover)

// Go back.
coordinator.pop()
03 / Architecture

How it composes, end to end.

Roots switch state, tabs hold flows, flows push screens. Hover to peek a node, click to pin it — the path back to the root highlights so you can see how it's wired.

Hover to peek · click a node to pin
04 / Playground

See it in motion.

The phone is a working prototype — tap rows, tabs, the gear, the back chevron. The action panel mirrors what's callable from the current coordinator: only valid Scaffolding functions appear at any given moment.

9:41 ●●●

Planets

Tap rows, tabs, gear, or back arrow to drive the simulation.

State

root .authenticated tab.selected .home home.stack [home] modal nil @Environment HomeCoordinator MainTabCoordinator AppCoordinator

Available actions

Stack
Present
Tabs & root

Console

  1. // Tap something on the phone or press an action.
  • Type-safe destinations from a Swift macro
  • Push, sheet, and full-screen cover, separated
  • Nested coordinator flows across modules
  • Atomic root switches for auth and onboarding
  • Environment-injected coordinators
  • iOS 18 / macOS 15 / watchOS 11 / tvOS 18