Onboarding generator

From gustavscirulis/snapgrid · View interactive version

Onboarding generator is an AI agent skill from the GitHub repository gustavscirulis/snapgrid. Generates multi-step onboarding flows with persistence for iOS/macOS apps. Use when user wants to add onboarding, welcome screens, or first-launch experience.

How to use this skill

Skill file

Onboarding Generator

Generate a complete, customizable onboarding flow with persistence, animations, and accessibility support.

When This Skill Activates

Use this skill when the user:

Pre-Generation Checks

1. Project Context Detection

2. Conflict Detection

Search for existing onboarding:

Glob: **/*Onboarding*.swift, **/*Welcome*.swift
Grep: "hasCompletedOnboarding" or "isFirstLaunch"

If found, ask user:

Configuration Questions

Ask user via AskUserQuestion:

  1. Navigation style?
  1. Number of screens?
  1. Skip option?
  1. Presentation style?
  1. Include animations?

Generation Process

Step 1: Create Core Files

Generate these files:

  1. OnboardingView.swift - Main container
  2. OnboardingPageView.swift - Individual page template
  3. OnboardingPage.swift - Page data model
  4. OnboardingStorage.swift - Persistence
  5. OnboardingModifier.swift - View modifier for easy integration

Step 2: Customize Based on Configuration

Paged Navigation:

TabView(selection: $currentPage) {
    ForEach(pages) { page in
        OnboardingPageView(page: page)
            .tag(page.id)
    }
}
.tabViewStyle(.page(indexDisplayMode: .always))

Stepped Navigation:

VStack {
    OnboardingPageView(page: pages[currentPage])

    HStack {
        if currentPage > 0 {
            Button("Back") { currentPage -= 1 }
        }
        Spacer()
        Button(isLastPage ? "Get Started" : "Next") {
            if isLastPage {
                completeOnboarding()
            } else {
                currentPage += 1
            }
        }
    }
}

Step 3: Determine File Location

Check project structure:

Output Format

After generation, provide:

Files Created

Sources/Onboarding/
├── OnboardingView.swift           # Main container
├── OnboardingPageView.swift       # Page template
├── OnboardingPage.swift           # Data model
├── OnboardingStorage.swift        # @AppStorage persistence
└── OnboardingModifier.swift       # .onboarding() modifier

Integration Steps

Option 1: View Modifier (Recommended)

@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .onboarding()  // Automatically shows on first launch
        }
    }
}

Option 2: Manual Control

@main
struct MyApp: App {
    @AppStorage("hasCompletedOnboarding") private var hasCompletedOnboarding = false

    var body: some Scene {
        WindowGroup {
            ContentView()
                .fullScreenCover(isPresented: .constant(!hasCompletedOnboarding)) {
                    OnboardingView()
                }
        }
    }
}

Customization

Add Your Content:

// In OnboardingStorage.swift or OnboardingView.swift
static let pages: [OnboardingPage] = [
    OnboardingPage(
        title: "Welcome",
        description: "Your app description here",
        imageName: "hand.wave",  // SF Symbol or asset name
        accentColor: .blue
    ),
    // Add more pages...
]

Testing Instructions

  1. Delete app from simulator (to reset UserDefaults)
  2. Run app - onboarding should appear
  3. Complete onboarding
  4. Relaunch app - onboarding should NOT appear
  5. Reset via Settings or delete app to test again

Debug/Testing Reset

// Add to Settings or debug menu
Button("Reset Onboarding") {
    UserDefaults.standard.removeObject(forKey: "hasCompletedOnboarding")
}

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.