Skip to content

Instantly share code, notes, and snippets.

@thangtv611
Forked from StewartLynch/HabitTrackerPrompt.md
Created April 18, 2026 13:30
Show Gist options
  • Select an option

  • Save thangtv611/10f7f92571f37be490664afbc78d5db0 to your computer and use it in GitHub Desktop.

Select an option

Save thangtv611/10f7f92571f37be490664afbc78d5db0 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