View micro and macro nutrients from a bundled Excel file, switch serving sizes, and log foods to a daily calculator with goals (MyFitnessPal-style).
-
Open the project
- Open
NutrientProfileApp.xcodeprojin Xcode (double-click or File → Open). - Xcode will resolve the CoreXLSX package dependency automatically.
- Open
-
Add your Excel file to the app bundle
- Copy
nutrient profile.xlsx(e.g. from your Desktop) into theNutrientProfileAppfolder in Finder. - In Xcode, right-click the
NutrientProfileAppgroup → Add Files to "NutrientProfileApp" → selectnutrient profile.xlsx, check Copy items if needed and your app target. Ensure the file appears under Build Phases → Copy Bundle Resources.
- Copy
-
Build and run
- Select a simulator (e.g. iPhone 16) and press ⌘R.
- Foods tab: List of foods from the Excel file. Tap a food to see nutrients and serving picker; use Add to Today to log it.
- Today tab: Daily log, totals (calories, protein, carbs, fat), and goals with progress. Use Goals to set daily targets.
- Account tab: AI food search API key (see below).
- AI food search: In the Foods tab, use the AI search section: type a food (e.g. "1 medium banana" or "grilled chicken 100g"), tap Search, then tap an AI result to open it and Add to Today. Requires an OpenAI (or compatible) API key in Account.
- Apple Health: Logged foods are written to Health (calories, protein, fat, carbs, fiber, sugar, sodium, and selected vitamins/minerals). On first run the app will ask for Health write permission. If you see an entitlement error, add the HealthKit capability in Xcode (Signing & Capabilities → + Capability → HealthKit).
The Foods tab can search for foods using an LLM and add results to your log.
- API key: Open Account → AI food search → enter your OpenAI API key (or another OpenAI-compatible endpoint key) → Save API key. The key is stored in the iOS Keychain.
- Search: In Foods, type a query in the AI search field (e.g. "1 medium banana", "grilled chicken breast 100g") and tap Search. Results appear under AI results.
- Add to Today: Tap an AI result to open its detail (nutrients); use Add to Today as with profile foods. The entry is saved to your log and can sync to Apple Health.
The app uses the OpenAI chat API (gpt-4o-mini by default). You can change LLMFoodService.apiBaseURL and the model in code to use another provider.
- One sheet per food (or one main sheet). Each sheet:
- Row 1: Food name (A1), Serving size (B1)
- Row 2: Headers —
Nutrient,Value,%DV - Row 3+: One row per nutrient; Value can include unit (e.g.
15g,210mg); %DV is a number or-
- Optional Servings sheet: Column A = serving label (e.g.
1 TBSP,3 TBSP), Column B = ratio (e.g.0.333,1) so the app can recalculate when you switch serving.
Your file at nutrient profile.xlsx should be added to the project as described in step 4.