A smart iOS application that helps users make informed dietary choices by analyzing food labels instantly. Using advanced OCR technology and AI-powered analysis, Food Scanner MVP identifies allergens, dietary compliance, and safety concerns with a single photo.
- Instant OCR: Capture food label photos and automatically extract ingredient text using Vision Framework
- High Accuracy: Utilizes iOS's native Vision framework with language correction for reliable text extraction
- Editable Results: Manual correction or direct text input for ingredients
- Multi-Provider Support: Leverages Google Gemini 2.5 Flash for intelligent ingredient analysis
- Comprehensive Safety Assessment: Identifies:
- ❌ Pork and alcohol derivatives
⚠️ Common allergens- 🚫 Unsafe ingredients based on user preferences
- ✅ Dietary rule compliance
- Custom Preferences: Support for multiple dietary rules (Halal, Vegan, Vegetarian, Keto, Sugar-Free, etc.)
- Allergen Management: Create and manage personal allergen lists
- Real-Time Compliance Checking: Instant verification against your dietary constraints
- Firebase Integration: Secure authentication and data handling
- Local Processing: Image processing happens on-device for privacy
- No Cloud Storage: Your dietary preferences stay with you
- Language: Swift
- UI Framework: SwiftUI
- OCR: Vision Framework (Apple's native solution)
- AI/ML: Google Gemini 2.5 Flash via Firebase AI Logic
- Backend: Firebase (Authentication & Configuration)
- Storage: UserDefaults (Local preferences)
- OCRService: Handles image text recognition with language correction
- GeminiService: AI-powered ingredient analysis and safety assessment
- AIService Protocol: Abstraction for multiple AI providers
- ProviderManager: Manages multiple AI providers with fallback support
- KeywordFallbackService: Backup analysis when primary providers fail
- ScanViewModel: Manages image selection, OCR processing, and analysis state
- SettingsViewModel: Handles user preferences (dietary rules, allergens, AI provider selection)
- ResultsViewModel: Manages analysis results display logic
- ScanView: Main interface for image selection and analysis
- ResultsView: Displays comprehensive safety assessment
- SettingsView: Manage dietary preferences and AI provider
- AboutView: Application information and guidance
- iOS 14.0 or later
- Xcode 15.0+
- CocoaPods (for dependency management)
-
Clone the Repository
git clone <repository-url> cd "Food Scanner MVP"
-
Install Dependencies
pod install
-
Firebase Setup
- Download
GoogleService-Info.plistfrom Firebase Console - Add it to the Xcode project (replace existing file)
- Ensure Firebase AI Logic is configured
- Download
-
Build & Run
- Open
Food Scanner MVP.xcworkspacein Xcode - Select your target device or simulator
- Press
Cmd + Rto build and run
- Open
- Open the App → Navigate to the Scan tab
- Select Image → Tap "Select Image" to choose a food label photo
- Review Text → OCR automatically extracts ingredients (editable)
- Set Preferences → Configure your dietary rule and allergens in settings
- Run Analysis → Tap "Run Analysis" to check safety
- Review Results → See detailed findings with specific warnings and notes
- Halal User: Detects pork, alcohol, and non-halal ingredients
- Vegan User: Identifies animal products (dairy, eggs, gelatin, honey)
- Allergy Sufferer: Flags specific allergens and cross-contamination risks
- Health-Conscious: Checks for sugar, additives, or other restrictions
Each analysis returns:
{
"containsPork": boolean,
"containsAlcohol": boolean,
"allergens": ["string"],
"unsafeIngredients": ["string"],
"analysisNotes": "string",
"isSafeForUser": boolean
}- On-Device Processing: Images are processed locally; only ingredients text is sent to AI
- User Control: You control which AI provider to use
- No Tracking: Application respects user privacy
- Fallback System: If primary AI fails, keyword-based fallback ensures functionality
- OCR accuracy varies based on image quality and label clarity
- Complex ingredient lists may require manual correction
- Language support currently limited to English
- Google Gemini team for AI analysis capabilities
- Apple Vision Framework documentation
- Firebase team for backend infrastructure
- The open-source community for inspiration and support