Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸƒ MacroLens

AI-powered, fully on-device iOS nutrition & body-recomposition tracker. Snap a photo of a meal, get an instant macro + micronutrient breakdown, and let an adaptive coach steer your targets toward your goals.

Platform Swift UI Persistence AI

MacroLens keeps all of your data on-device (SwiftData). The only thing that ever leaves your phone is a single meal-photo analysis request to the Google Gemini API.

✨ Features

  • πŸ“Έ AI meal analysis β€” photo(s) + a short description β†’ calories, macros, sugar, and a per-ingredient breakdown via Gemini. Every number is editable before saving.
  • πŸ“Š Today dashboard β€” calorie ring, macro rings, and a sugar bar. Tap any metric to drill into exactly which foods contributed β€” down to each ingredient in a composite meal.
  • 🧬 Vitamins & minerals β€” per-ingredient micronutrient estimates with RDA progress bars and deficiency / excess flags, driven by an extensible nutrient catalog.
  • πŸ₯€ Drinks & πŸ’§ hydration β€” log caloric beverages (protein/carbs/fat/sugar) and water, with per-beverage hydration coefficients and a 7-day hydration chart.
  • πŸ’Š Supplements & creatine β€” manual logging (e.g. a 5 g creatine scoop) plus creatine estimated from food, combined into a daily total.
  • 🧠 Adaptive nutrition planning β€” estimates your real maintenance calories from intake + weight trend (energy balance) and proposes target adjustments, with a plain-language explanation of what changed and why.
  • πŸ€– Coach β€” prioritized, trend-based, encouraging recommendations generated from your history, plus a conversational chat coach.
  • πŸ“· Per-100 g label entry β€” type a package's per-100 values and how much you had; the totals are computed for you.
  • πŸ—“οΈ History β€” a day-by-day timeline of meals, drinks, and water; calendar view; swipe to delete; tap a meal to edit or re-analyze.
  • βš–οΈ Body metrics β€” weight & body-fat logging with a Swift Charts trend, optional HealthKit-ready design.
  • πŸŒ™ Configurable day boundary β€” late-night meals (before, say, 3 AM) count toward the previous day.
  • πŸ”” Reminders β€” on-device meal & hydration reminders (no paid entitlement required).
  • 🌍 Localized β€” English, Russian, and Kazakh.

πŸ›  Tech stack

  • Swift + SwiftUI, targeting iOS 26
  • SwiftData for all local persistence
  • Swift Charts for trends
  • PhotosUI + camera for meal photos
  • Google Gemini API (gemini-3-flash-preview, free tier) as the single networking layer
  • No backend, no cloud database, no third-party analytics

πŸ— Architecture

MacroLens/
β”œβ”€β”€ MacroLensApp.swift     # @main, SwiftData ModelContainer
β”œβ”€β”€ Models/                # @Model types, the extensible Nutrient catalog, computed DayLog
β”œβ”€β”€ Services/              # Gemini, HistoryAnalyzer, AdaptivePlanner, Keychain, AppRouter,
β”‚                          # AppShortcuts, Notifications, ImageProcessing, Localization, DayBoundary
β”œβ”€β”€ DesignSystem/          # "Calm Instrument" β€” Theme (tokens/motion) + reusable Components
└── Views/                 # Today Β· Add (Meal/Drink/Supplement) Β· History Β· Body Β· Coach Β· Settings

An extensible nutrient catalog (Models/Nutrient.swift) is the single source of truth: it drives the Gemini response schema, the per-metric drill-downs, and RDA tracking β€” adding a new vitamin, mineral, or supplement is a one-line change.

The UI is built on a single design system (DesignSystem/): one card, one ring scale, one status ramp, one row β€” so every tab reads as one system, in light & dark and across English/Russian/Kazakh. Back-tap shortcuts ("Log Meal" / "Log Drink") deep-link into logging via App Intents.

πŸš€ Getting started

Requirements: Xcode 26, an iPhone on iOS 26, and an Apple ID (a free one works β€” this app is built for personal sideloading).

  1. git clone https://github.com/YeraSss/MacroLens.git
  2. Open MacroLens.xcodeproj.
  3. Select the MacroLens target β†’ Signing & Capabilities β†’ choose your team (free Apple ID is fine). Change the bundle identifier if it collides.
  4. Build & run on your device (⌘R). On the iPhone, enable Developer Mode and trust the developer certificate on first launch.

πŸ”‘ Gemini API key

The app never ships a key. Add yours in Settings β†’ API Key β€” it's stored only in the iOS Keychain, on your device. Get a free key at https://aistudio.google.com/apikey and keep billing disabled to stay on the free tier.

(Optional: you can pre-seed a key via a gitignored Secrets.xcconfig β€” see Secrets.example.xcconfig.)

πŸ”’ Privacy

All data lives locally via SwiftData. The only outbound network request is the single meal-photo (and drink) analysis to Gemini. No accounts, no analytics, no servers.

πŸ“ Notes

A personal project, built for one device via free-Apple-ID sideloading β€” not on the App Store. Not affiliated with Google or Apple.

About

πŸ“ΈπŸƒ AI-powered, on-device iOS nutrition & body-recomposition tracker β€” snap a meal, get macros + micronutrients via Gemini, with an adaptive coach. SwiftUI Β· SwiftData Β· Swift Charts.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages