Welcome to FriendlyMeals, a sample iOS project accompanying the Firebase Fundamentals video series on YouTube.
FriendlyMeals app – Hero screenshot with gradient background
This repository demonstrates how to integrate Firebase features into an iOS app, with a strong focus on Firebase AI Logic (Vertex AI in Firebase), Cloud Firestore, and Remote Config.
- Nutrition Detective: Take a photo of a meal, and the app uses multimodal generative AI (Gemini) to analyze its nutritional content (calories, protein, fats, carbs) and explain its reasoning stream-by-stream.
- Recipe Wizard: Suggests complete recipes based on ingredients you have. It uses structured output (JSON mode) for reliable data parsing and can generate visual previews of the dish using image generation models.
- Chef Chat: An interactive meal planner chat with a "spicy celebrity chef" persona. It demonstrates Function Calling capabilities by allowing the AI to start and manage cooking timers within the app.
- Cookbook (Firestore): Save, view, and manage your favorite recipes. Data is persisted securely using Cloud Firestore.
- Dynamic Settings (Remote Config): The app allows you to change behavior on the fly—such as the maximum number of daily image generations or the specific AI model version—using Firebase Remote Config, without needing an App Store update.
The project is organized by feature, keeping related SwiftUI Views, ViewModels, and logic together:
FriendlyMeals/
└── FriendlyMeals/
└── Features/
├── Camera/ # Camera integration for nutrition scanning
├── Cookbook/ # Firestore-backed recipe list
├── DetectNutrition/ # Multimodal AI analysis of food photos
├── MealPlannerChat/ # AI Chat with Function Calling (Timers)
├── Services/ # Core services (RecipeService, RemoteConfigService)
└── SuggestRecipe/ # AI Recipe generation (Text & Image)
Follow these steps to get the app running on your machine.
git clone <repo-url>- Go to the Firebase Console.
- Click Add project and follow the prompts.
- In the Firebase Console, click Add app > iOS.
- Enter the bundle ID:
com.google.firebase.samples.FriendlyMeals - (Optional) Enter an app nickname and App Store ID.
- Click Register app.
- Download the
GoogleService-Info.plistfile from the Firebase Console. - Open
FriendlyMeals.xcodeprojin Xcode. - Drag and drop the downloaded file into the
FriendlyMeals/FriendlyMealsfolder in the Xcode Project Navigator. - Important: Ensure Copy items if needed is checked and the file is added to the "FriendlyMeals" target.
To make the app fully functional, enable these services in your Firebase Console:
- Vertex AI in Firebase: Required for all AI features.
- Note: Ensure the "Blaze" (Pay as you go) plan is enabled if required by the models you choose.
- Cloud Firestore: Create a database. Start in Test Mode for quick setup (remember to secure your rules later!).
- Remote Config: Enable Remote Config to manage app behavior dynamically.
The app uses two files to manage Remote Config parameters:
remote_config_defaults.plist: This file (already in the Xcode project) contains in-app default values. These are used immediately when the app launches.remote_config_template.json: This file contains the server-side configuration.
Option A: Import via Console (Recommended)
- Go to Remote Config in the Firebase Console.
- Click on the menu (three dots) in the top right corner of the Remote Config dashboard.
- Select Import configurations.
- Upload the
FriendlyMeals/FriendlyMeals/remote_config_template.jsonfile from this repository. - Review the changes and click Publish.
Option B: Use Firebase CLI If you have the Firebase CLI installed and initialized, you can publish the template directly:
firebase remoteconfig:publish FriendlyMeals/FriendlyMeals/remote_config_template.json- Select a simulator or connected device in Xcode.
- Build and run the project (
Cmd + R).
Contributions and suggestions are welcome! Feel free to open issues or pull requests as you follow along with the series.
This project is licensed under the Apache License, which can be found in the root of this repository. It is provided for educational purposes as part of the Firebase Fundamentals video series.