Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HabitLoop

HabitLoop is a modern, privacy-focused iOS habit tracking application engineered with SwiftUI, Core Data, WidgetKit, and modern Swift concurrency. Designed with Apple Human Interface Guidelines (HIG) at its core, HabitLoop features algorithmic pattern detection, weekly AI reflections, interactive widgets, and instant offline synchronization.


Screenshots

Today View
Today Dashboard
Add/Edit Habit
Add/Edit Habit
Habit Detail & Heatmap
Detail & Heatmap
Library Search & Grid
Library (List/Grid)
Pattern Insights & Reflection
Pattern Insights
WidgetKit Home Screen
Home Screen Widgets

Video Demo

HabitLoop Video Demo Showcase

Click above to watch the interactive walk-through video (docs/demo.mp4)


Key Features

  • Daily Habit Dashboard: Real-time completion progress count (3/5), animated progress rings, streak counters (🔥), and instant haptic toggle interactions.
  • 12-Week Activity Heatmap: Visual 84-day completion grid, monthly completion percentage rates, and total completion stats without third-party chart dependencies.
  • Algorithmic Pattern Insights:
  • Weekday vs. Weekend Gap: Statistical analysis surfacing consistency discrepancies ($\ge 30%$ gap).
  • Best Time of Day: Categorizes habit completions into Morning, Afternoon, and Evening peak performance buckets.
  • Streak Risk Alerts: Proactive warnings when an active habit streak is at risk based on historical completion time windows.
  • Weekly AI Reflection: On-device reflection engine leveraging FoundationModels (iOS 18.1+) with deterministic fallback summaries and Core Data caching (HabitInsightCacheEntity).
  • Interactive Home Screen Widgets:
  • Small Widget (systemSmall): Circular progress ring & completion fraction.
  • Medium Widget (systemMedium): Interactive list allowing users to mark habits complete directly from their Home Screen via AppIntents (ToggleHabitIntent).
  • Library Management: Active and Archived segmented filtering, live title searching, drag-to-reorder custom sorting, and List/Grid layout modes.
  • Preferences & Data Portability: Master notification controls, active reminder list navigation, system/light/dark appearance switching, and CSV & JSON export using SwiftUI ShareLink.

Architecture & Engineering Design

Technical Highlights

  1. State Management: Built with the Observation framework (@Observable) introduced in iOS 17, eliminating @Published overhead and optimizing UI re-renders.
  2. Repository Pattern: Strict decoupling of Core Data managed object entities (HabitEntity, HabitCompletionEntity) from pure domain value types (Habit, HabitCompletion).
  3. Shared Persistent Container: Core Data persistent store configured for App Group URL (group.com.ishouryasonu.habitloop), enabling real-time data sharing between the main app process and WidgetKit extensions.
  4. AppIntents Integration: ToggleHabitIntent allows background Core Data mutation and triggers immediate Widget timeline refreshes (WidgetCenter.shared.reloadAllTimelines()).
  5. Zero External Dependencies: Built 100% natively using Apple frameworks (SwiftUI, CoreData, WidgetKit, UserNotifications, AppIntents, Foundation).
  6. Accessibility & HIG Polish: Includes Dynamic Type scaling, minimum 44pt touch target areas, UIImpactFeedbackGenerator / UINotificationFeedbackGenerator haptics, and complete VoiceOver labels & hints.

Testing

The repository includes a comprehensive unit test suite written with XCTest:

  • HabitRepositoryTests: Core Data CRUD operations, completion toggling, date interval queries, and cascade deletions using in-memory store configurations.
  • TodayViewModelTests: Daily completion counts, fraction progress calculations, and streak evaluations.
  • AddEditHabitViewModelTests: Input validation, creation/edit prepopulation modes, and frequency mapping.
  • HabitDetailViewModelTests: 12-week (84-day) heatmap date calculations, current & longest streak math.
  • LibraryViewModelTests: Search filtering, active vs. archived segmentation, and custom drag-and-drop reordering (sortOrder).
  • PatternInsightServiceTests: Deterministic date tests for weekday vs. weekend gap thresholds, peak time-of-day bucketing, and streak risk triggers.
  • ReflectionServiceTests: Weekly reflection generation and fallback logic.
  • NotificationServiceTests: Permissions & reminder cancellation logic.
  • WidgetTests: HabitEntry progress calculations and ToggleHabitIntent execution.

About

HabitLoop is a modern, privacy-focused iOS habit tracking application engineered with SwiftUI, Core Data, WidgetKit, and modern Swift concurrency. Designed with Apple Human Interface Guidelines (HIG) at its core, HabitLoop features algorithmic pattern detection, weekly AI reflections, interactive widgets, and instant offline synchronization.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages