Skip to content

A modern habit-tracking iOS app built with SwiftUI and GRDB, designed to help users build and maintain evidence-based habits that promote long-term health and longevity. Features anti-aging rating system, smart categories, and flexible scheduling.

License

Notifications You must be signed in to change notification settings

banghuazhao/longevity-master

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Longevity Master πŸƒβ€β™‚οΈ

Swift iOS SwiftUI License

A modern habit-tracking iOS app built with SwiftUI and GRDB, designed to help users build and maintain habits that promote long-term health and longevity. Longevity Master focuses on evidence-based habits that contribute to healthy aging and overall well-being.

πŸ“± Download on the App Store

Now available on the App Store! πŸŽ‰

Build powerful daily habits to extend your lifespan. Longevity Master helps you live longer and feel better with science-based routines for health and wellness.

πŸ“± Screenshots

Longevity Master Screenshot 1 Longevity Master Screenshot 2 Longevity Master Screenshot 3 Longevity Master Screenshot 4

The app features a clean, modern interface with habit cards, tracking views, and intuitive navigation designed to help users build lasting health habits.

✨ Features

🎯 Core Functionality

  • Habit Tracking: Create, edit, and track daily habits with customizable frequencies
  • Anti-Aging Rating System: Each habit includes a 1-5 star rating based on scientific evidence for longevity benefits
  • Smart Categories: Organized into 5 key areas (Diet, Exercise, Sleep, Preventive Health, Mental Health)

πŸ† Achievement System

  • 24 Achievements: Streak milestones, check-in goals, perfect weeks/months, category mastery, time-based challenges
  • Progress Tracking: Visual progress bars and celebration animations
  • Social Sharing: Share achievements with friends

πŸ”” Smart Reminders

  • Customizable Notifications: Set personalized reminder times for each habit
  • Habit-Specific Alerts: Link reminders directly to individual habits
  • Easy Management: Simple setup and notification preferences

⭐ Longevity Rating System

  • 12-Level Rating: From Beginner (F) to Legend (SSS) based on overall health habits
  • Multi-Dimensional Scoring: Active habits, anti-aging ratings, achievements, check-ins, and streaks
  • Progress Analytics: Detailed breakdowns and improvement tips

🎨 User Experience

  • Modern SwiftUI Interface: Clean, intuitive design following iOS guidelines
  • Flexible Scheduling: Support for various frequency patterns (weekly, monthly, custom)
  • Theme Customization: Multiple color themes and personalization options
  • Haptic Feedback & Sound Effects: Enhanced user interaction

πŸ’Ύ Data Management

  • GRDB Database: Robust local data storage with SQLite
  • Calendar Integration: Monthly and yearly habit tracking views
  • Streak Calculation: Automatic streak tracking with flexible settings
  • Data Export: Built-in data export capabilities

πŸ“Š Analytics & Insights

  • Habit Statistics: Detailed analytics for each habit
  • Progress Visualization: Calendar views showing completion patterns
  • Category Analysis: Performance breakdown by habit category
  • Achievement Progress: Visual progress tracking for all achievements

πŸ”§ Advanced Features

  • Habit Archiving: Archive habits without losing data
  • Icon Customization: Choose from extensive emoji icon library
  • Multi-language Support: English and Simplified Chinese localization

πŸ—οΈ Architecture

Tech Stack

  • SwiftUI 5.0: Modern declarative UI framework
  • GRDB: SQLite database with Swift integration
  • Observation Framework: Reactive data binding
  • SwiftUINavigation: Type-safe navigation handling

Project Structure

LongevityMaster/
β”œβ”€β”€ App/
β”‚   └── LongevityMasterApp.swift          # App entry point
β”œβ”€β”€ Components/
β”‚   β”œβ”€β”€ Common/                           # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ HabitCardView.swift
β”‚   β”‚   └── HabitItemView.swift
β”‚   β”œβ”€β”€ Habits/                           # Habit management views
β”‚   β”‚   β”œβ”€β”€ HabitForm.swift
β”‚   β”‚   β”œβ”€β”€ HabitIconEdit.swift
β”‚   β”‚   β”œβ”€β”€ HabitsGallery.swift
β”‚   β”‚   └── HabitsList.swift
β”‚   β”œβ”€β”€ Me/                               # User profile and settings
β”‚   β”‚   β”œβ”€β”€ AppItem.swift
β”‚   β”‚   β”œβ”€β”€ MeFeature.swift
β”‚   β”‚   └── MoreAppsView.swift
β”‚   └── Today/                            # Daily habit tracking
β”‚       β”œβ”€β”€ TodayView.swift
β”‚       └── TodayViewModel.swift
β”œβ”€β”€ Model/                                # Data models
β”‚   β”œβ”€β”€ CheckIn.swift
β”‚   β”œβ”€β”€ Habit.swift
β”‚   └── TodayHabit.swift
β”œβ”€β”€ Service/                              # Business logic and data services
β”‚   β”œβ”€β”€ HabitIconColorDataSource.swift
β”‚   β”œβ”€β”€ HabitIconDataSource.swift
β”‚   └── HabitsDataStore.swift
└── Utilities/                            # Helper functions and extensions
    β”œβ”€β”€ Constants.swift
    β”œβ”€β”€ Extension/
    β”‚   β”œβ”€β”€ Color+Extensions.swift
    β”‚   β”œβ”€β”€ Date+Extension.swift
    β”‚   └── Habit+Extension.swift
    β”œβ”€β”€ HashableObject.swift
    └── Schema.swift

πŸš€ Getting Started

For Users

Download Longevity Master from the App Store and start building healthy habits today!

For Developers

Prerequisites

  • Xcode 15.0 or later
  • iOS 17.0+ deployment target
  • macOS 14.0+ (for development)

Installation

  1. Clone the repository

    git clone https://github.com/banghuazhao/longevity-master.git
    cd longevity-master
  2. Open in Xcode

    open LongevityMaster.xcodeproj
  3. Build and Run

    • Select your target device or simulator
    • Press Cmd + R to build and run the app

Development Setup

The project uses several key dependencies managed through Swift Package Manager:

  • GRDB: Database layer
  • SwiftUINavigation: Navigation handling
  • Observation: Reactive programming

πŸ”§ Configuration

Database Setup

The app uses GRDB for local data storage. The database is automatically initialized when the app launches.

Customization

  • Habit Categories: Easily extend the HabitCategory enum to add new categories
  • Frequency Types: Modify HabitFrequency to support different scheduling patterns
  • UI Themes: Customize colors and styling in the Constants.swift file

🀝 Contributing

We welcome contributions! Please follow these guidelines:

Development Process

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Follow Swift style guidelines
  • Use meaningful variable and function names
  • Add comments for complex logic
  • Ensure all code compiles without warnings

Testing

  • Test on both iPhone and iPad simulators
  • Verify functionality across different iOS versions
  • Test edge cases and error scenarios

πŸ“„ License

This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).

This means you can:

  • βœ… Use, share, and modify the code for non-commercial purposes
  • βœ… Distribute the code with proper attribution
  • ❌ Use the code for commercial purposes without permission

πŸ†˜ Support

πŸ—ΊοΈ Roadmap

Long-term Goals

  • AI powered scientific habit recommendations
  • Integration with HealthKit
  • Data export and backup
  • Community features

πŸ™ Acknowledgments

  • Built with ❀️ using SwiftUI and modern iOS development practices
  • Inspired by scientific research on longevity and healthy aging
  • Thanks to the open-source community for amazing tools and libraries

Made with ❀️ by Banghua Zhao

Empowering users to build habits that last a lifetime 🌟

About

A modern habit-tracking iOS app built with SwiftUI and GRDB, designed to help users build and maintain evidence-based habits that promote long-term health and longevity. Features anti-aging rating system, smart categories, and flexible scheduling.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages