state-restoration

Restore navigation paths, tabs, scroll positions, and form drafts in SwiftUI apps.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/jtvaris/sunday-night-dynasty --skill state-restoration-jtvaris
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state-restoration
Source: https://github.com/jtvaris/sunday-night-dynasty/tree/main/.agents/skills/generators/state-restoration
Command: npx skills add https://github.com/jtvaris/sunday-night-dynasty --skill state-restoration-jtvaris

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Saving and restoring app UI state across launches to resume where the user left off.

Core Features & Use Cases

  • Preserves navigation paths, selected tabs, scroll positions, and in-progress form drafts across sessions.
  • Supports deterministic, debounced saves and multiple persistence backends (file-based or UserDefaults).
  • Real-world use: an app returns the user to the same screen with the same data after termination.

Quick Start

Configure the system to automatically save and restore last navigation state, tab choice, and UI drafts.

Frequently Asked Questions about state-restoration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I save and restore SwiftUI navigation paths and tab selections across app launches?

You can save and restore SwiftUI navigation paths and tab selections by using Codable state models with @Observable management, persisting data via file-based or UserDefaults backends to resume UI state on launch.

What is the best way to preserve scroll position and form drafts in a SwiftUI app?

The best way to preserve scroll position and form drafts is to implement debounced autosave routines that write UI state to a persistent backend, allowing the app to restore in-progress data deterministically.

Does this state restoration approach work with NavigationStack and TabView on macOS?

Yes, this state restoration approach works with NavigationStack and TabView on both iOS and macOS, applying per-scene state management to handle deterministic save points and optional restoration behaviors.

How do I configure deterministic save points for SwiftUI app state restoration?

You configure deterministic save points by defining Codable state models and applying debounced autosave logic, optionally prompting the user before persisting state to file-based or UserDefaults storage.

Can I use UserDefaults for persisting SwiftUI state instead of file-based storage?

Yes, you can use UserDefaults as a persistence backend for SwiftUI state instead of file-based storage, applying debounced autosave routines to manage navigation paths and tab selections efficiently.

When should I avoid debounced autosave for app state restoration?

You should avoid debounced autosave when you require immediate deterministic saves without delays, or when optional user prompts are necessary to confirm state preservation before app termination.