Skip to content

MiniHabits iOS: A modern SwiftUI app for tracking daily habits and building consistency. Features boolean and counter-based habit tracking, streak monitoring, multiple environments, and offline demo mode. Built with MVVM architecture.

Notifications You must be signed in to change notification settings

fberrez/minihabits-ios

Repository files navigation

MiniHabits iOS

A modern iOS app for tracking daily habits and building consistency.

MiniHabits iOS

Features

  • Habit Tracking: Track both boolean (yes/no) and counter-based habits
  • Streaks: Monitor your current and longest streaks for each habit
  • Multiple Environments: Switch between development and production environments
  • Demo Mode: Try the app with sample data without requiring an internet connection
  • Modern UI: Clean, intuitive interface following Apple's design guidelines

Getting Started

Prerequisites

  • Xcode 15.0+
  • iOS 17.0+
  • Swift 5.9+

Installation

  1. Clone the repository
git clone https://github.com/fberrez/minihabits-ios.git
cd minihabits-ios
  1. Open the project in Xcode
open minihabits-ios.xcodeproj
  1. Build and run the application on your simulator or device

Architecture

MiniHabits iOS follows the MVVM (Model-View-ViewModel) architecture pattern:

  • Models: Data structures like Habit that represent the core entities
  • Views: SwiftUI views that display the UI
  • ViewModels: Classes like HabitsViewModel that manage the business logic and data flow

Key Components

  • APIClient: Handles all network communication with the MiniHabits API
  • HabitsViewModel: Manages habit data and operations
  • ContentView: Main view that displays the list of habits
  • HabitDetailView: Detailed view for a specific habit
  • HabitFormView: Form for creating and editing habits

API Integration

The app connects to the MiniHabits API for data persistence. It supports:

  • Authentication: Sign up and sign in functionality
  • CRUD Operations: Create, read, update, and delete habits
  • Habit Tracking: Track habit completion and manage streaks

Environment Configuration

Two environments are supported:

  • Development: Connects to http://localhost:3000
  • Production: Connects to https://minihabits-api.fberrez.co

Usage

Creating a Habit

  1. Tap the "+" button in the top right corner
  2. Enter a name for your habit
  3. Select the habit type (boolean or counter)
  4. For counter habits, set a daily target
  5. Choose a color
  6. Tap "Add"

Tracking Habits

  • Boolean Habits: Tap the circle to mark as complete
  • Counter Habits: Use the "+" and "-" buttons to increment or decrement the counter

Viewing Details

Tap on any habit to view detailed information, including:

  • Current and longest streaks
  • Daily target (for counter habits)
  • Progress tracking

Demo Mode

Enable demo mode in the Settings to use the app without an internet connection. This mode uses sample data for demonstration purposes.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • SwiftUI - For the modern UI framework
  • Combine - For reactive programming

About

MiniHabits iOS: A modern SwiftUI app for tracking daily habits and building consistency. Features boolean and counter-based habit tracking, streak monitoring, multiple environments, and offline demo mode. Built with MVVM architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages