Nutrition Module
The Nutrition module provides all nutrition-related UI screens and functionality.
Accessing the module
After connect, use sdk.modules.nutrition (e.g. AzeooSDK.shared.modules.nutrition).
Methods
showMainScreen
Shows the main nutrition screen with an overview of all nutrition features.
func showMainScreen(bottomSafeArea: Bool? = nil)
Parameters:
bottomSafeArea(Bool?, optional): Whether to apply bottom safe area. Defaults totrue.
Example:
nutrition?.showMainScreen(bottomSafeArea: true)
showNutritionPlans
Shows the nutrition plans screen where users can browse available nutrition plans.
func showNutritionPlans()
Example:
nutrition?.showNutritionPlans()
showNutritionPlan
Shows a specific nutrition plan.
func showNutritionPlan(_ planId: String)
Parameters:
planId(String): The ID of the nutrition plan to display.
Example:
nutrition?.showNutritionPlan("plan-123")
showUserNutritionPlan
Shows the user's current nutrition plan.
func showUserNutritionPlan()
Example:
nutrition?.showUserNutritionPlan()
showRecipes
Shows the recipes screen where users can browse recipes.
func showRecipes()
Example:
nutrition?.showRecipes()
showRecipe
Shows a specific recipe.
func showRecipe(_ recipeId: Int, recipeName: String? = nil)
Parameters:
recipeId(Int): The ID of the recipe to display.recipeName(String?, optional): Optional recipe name for better navigation.
Example:
nutrition?.showRecipe(12345, recipeName: "Chicken Salad")
showBarcodeScanner
Shows the barcode scanner screen for scanning food products.
func showBarcodeScanner()
Example:
nutrition?.showBarcodeScanner()
showMobileScanner
Shows the mobile scanner (alternative scanner implementation).
func showMobileScanner()
Example:
nutrition?.showMobileScanner()
showCart
Shows the shopping cart screen.
func showCart()
Example:
nutrition?.showCart()
showNutritionSearch
Shows the nutrition search screen for searching foods and nutrition information.
func showNutritionSearch()
Example:
nutrition?.showNutritionSearch()
showAddSelection
Shows the add selection screen for adding food items.
func showAddSelection()
Example:
nutrition?.showAddSelection()
showAddFood
Shows the add food screen.
func showAddFood()
Example:
nutrition?.showAddFood()
showAddMeal
Shows the add meal screen.
func showAddMeal()
Example:
nutrition?.showAddMeal()
Complete Example
import UIKit
import AzeooSDK
class NutritionViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
setupTableView()
}
private func setupTableView() {
tableView.delegate = self
tableView.dataSource = self
}
}
extension NutritionViewController: UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 6
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let nutrition = AzeooUI.instance?.nutrition
switch indexPath.row {
case 0:
cell.textLabel?.text = "Main Screen"
case 1:
cell.textLabel?.text = "Nutrition Plans"
case 2:
cell.textLabel?.text = "Recipes"
case 3:
cell.textLabel?.text = "Barcode Scanner"
case 4:
cell.textLabel?.text = "Shopping Cart"
case 5:
cell.textLabel?.text = "Search"
default:
break
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let nutrition = AzeooUI.instance?.nutrition
switch indexPath.row {
case 0:
nutrition?.showMainScreen()
case 1:
nutrition?.showNutritionPlans()
case 2:
nutrition?.showRecipes()
case 3:
nutrition?.showBarcodeScanner()
case 4:
nutrition?.showCart()
case 5:
nutrition?.showNutritionSearch()
default:
break
}
}
}
Next Steps
- Training Module - Training-related screens
- Configuration - Customize the UI
- Client API - Low-level API reference