Welcome to Passio Quick Start iOS demo application. It is designed to showcase the capabilities of the PassioNutritionAI SDK for iOS - featuring food recognition, detailed nutritional analysis, and portion size estimation. The codebase in this repository shows a clean UIKit implementation that can be partially or fully adopted by developers to integrate PassioNutritionAI SDK into their applications.
- 📸 Food recognition using device camera
- 🖼️ Food recognition from gallery images
- 🔍 Detailed nutritional information display
- 📊 Macronutrient breakdown with visual charts
- ⚖️ Dynamic serving size adjustments
- 🎯 Support for multiple measurement units
- 📱 Clean, modern iOS UI/UX
- iOS 14.0+
- Xcode 14.0+
- Swift 5.0+
- PassioNutritionAI SDK 3.2.2+
- Valid Passio SDK Key
- Clone the repository
git clone https://github.com/Passiolife/PassioQuickStart-iOS.git
-
Install dependencies via Swift Package Manager (SPM)
- The PassioNutritionAI SDK will be automatically installed through SPM
-
Configure SDK Key
- Copy
Config.example.swift
toConfig.swift
- Replace
YOUR_PASSIO_KEY_HERE
with your valid Passio SDK key
- Copy
-
Build and run the project in Xcode
- Launch the app
- Grant camera permissions when prompted
- Point camera at food item
- Tap capture button
- View recognition results and nutritional details
- Tap gallery button
- Select food image from device
- View recognition results and nutritional details
- View comprehensive macro and micronutrient breakdown
- Adjust serving sizes using slider or text input
- Switch between different measurement units
- View percentage distribution of macronutrients via donut chart
The app follows standard iOS architecture patterns:
- UI Layer: Storyboard-based UI with custom XIB components
- View Controllers: Handle user interaction and data presentation
- Custom Views: Reusable UI components like DonutChartView
- Extensions: Utility extensions for UIKit components
- Delegates: Clean communication between components
Key Components:
ImageSelectionVC
: Handles camera/gallery image captureRecognizeImageVC
: Manages food recognition processFoodDetailVC
: Displays detailed nutritional informationFoodNutrientsCell
: Visualizes nutritional dataDonutChartView
: Custom chart for macronutrient ratios
Here's how to initialize the PassioSDK:
private let passioSDK = PassioNutritionAI.shared
private var passioConfig = PassioConfiguration(key: Config.PASSIO_KEY)
func configurePassioSDK() {
passioConfig.debugMode = 0
passioSDK.statusDelegate = self
passioConfig.remoteOnly = true
passioSDK.configure(passioConfiguration: passioConfig) { status in
print("Mode = \(status.mode)")
print("Missingfiles = \(String(describing: status.missingFiles))")
}
}
- Architecture Pattern: Study the MVVC implementation and file organization
- Core Integration:
ImageSelectionVC
shows camera setup and image capture workflow - Recognition Flow:
RecognizeImageVC
demonstrates the food recognition pipeline - Results Handling:
FoodDetailVC
shows how to present nutritional data - UI Components: Reuse custom components like
DonutChartView
for macro visualization
- Minimal Dependencies: The SDK requires only UIKit - no additional frameworks needed
- Modular Components: Copy specific components like:
FoodNutrientsCell
for nutrition displayServingSizeCell
for portion controlDonutChartView
for macro ratio visualization
- SDK Configuration: See
configurePassioSDK()
for minimal setup requirements - Permission Handling: Check Info.plist for required camera/photo permissions
- UI Integration: Use either:
- Full screens (copy relevant ViewControllers)
- Individual components (copy specific Cells/Views)
- SDK Initialization:
private let passioSDK = PassioNutritionAI.shared
passioSDK.configure(passioConfiguration: config) { status in
// Handle configuration status
}
- Image Recognition:
PassioNutritionAI.shared.recognizeImageRemote(image: image) { foods in
// Handle recognition results
}
- Nutrition Display:
// Use FoodNutrientsCell for detailed nutrition
// Or access raw data:
let calories = foodItem.nutrientsReference().calories()?.value
let protein = foodItem.nutrientsReference().protein()?.value
Passio is a innovative AI technology company specializing in computer vision and machine learning solutions for nutrition, fitness and health. Our SDKs and APIs power food recognition and nutritional analysis in applications worldwide.
Made with ❤️ by Passio