Skip to content

Instantly share code, notes, and snippets.

@StewartLynch
Created February 10, 2026 16:38
Show Gist options
  • Select an option

  • Save StewartLynch/f49165e4309d930516ba1e36a6a818b3 to your computer and use it in GitHub Desktop.

Select an option

Save StewartLynch/f49165e4309d930516ba1e36a6a818b3 to your computer and use it in GitHub Desktop.
Habit Tracker Prompt

Create a SwiftUI Habit Tracker app using SwiftData with the following features:

  1. Data Model:

    • Habit: name, color, creation date, target frequency (daily/weekly)
    • HabitLog: date completed, relationship to Habit
    • Use SwiftData for persistence
  2. Main Features:

    • List view showing all habits with completion status for today
    • Ability to mark habits as complete/incomplete for today
    • Visual indicator (checkmark or circle) for completion
    • Display current streak for each habit
    • Color-coded habits using SF Symbols or colored circles
  3. Add/Edit Habits:

    • Sheet to create new habits
    • Choose habit name, color, and frequency
    • Simple form-based UI
  4. Detail View:

    • Show habit history (last 7-14 days)
    • Display total completions and current streak
    • Calendar-style view showing completion pattern

Use modern SwiftUI architecture with proper separation of concerns. Follow Apple's SwiftData best practices. Include sample data for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment