### Example Search Configuration JSON Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md This JSON configures search to use Passio and Edamam ingredient data, prioritize US and GB regions, filter by branded items from FDC and Passio sources, and ignore items with specific concern flags. Strict region mode is set to false. ```json { "dataSourceConfigs": [ {"name": "passio", "requestResultCount": 100}, {"name": "edamam_ingredients", "requestResultCount": 10} ], "regionFilters": {"us": 1, "gb": 3}, "typeFilters": ["branded"], "sourceFilters": ["fdc", "passio"], "strictRegionMode": false, "ignoreWithConcernFlags": [1002, 1100] } ``` -------------------------------- ### Start Nutrition Facts Detection Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Starts the detection of Nutrition Facts by pointing the camera at the nutrition facts label. Requires implementing the NutritionFactsDelegate. ```swift /// Use this function to detect Nutrition Facts via pointing the camera at Nutrition Facts /// - Parameters: /// - nutritionfactsDelegate: Add self to implement the NutritionFactsDelegate /// - completion: success or failure of the startNutritionFactsDetection func startNutritionFactsDetection( nutritionfactsDelegate: NutritionFactsDelegate?, capturingDeviceType: CapturingDeviceType = .defaultCapturing(), completion: @escaping (Bool) -> Void ) ``` -------------------------------- ### Get Supported Devices Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Retrieves a list of supported capturing devices for a given camera position and session preset. ```swift getSupportedDevice(for: AVCaptureDevice.Position = .unspecified, preset: AVCaptureSession.Preset = .high) -> [PassioNutritionAISDK.CapturingDeviceType] ``` -------------------------------- ### Enum RawValue Initialization Example Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Demonstrates how to initialize an enum with a raw value, showing successful and nil cases. This is useful for converting string representations back into enum instances. ```swift enum PaperSize: String { case A4, A5, Letter, Legal } print(PaperSize(rawValue: "Legal")) // Prints "Optional(PaperSize.Legal)" print(PaperSize(rawValue: "Tabloid")) // Prints "nil" ``` -------------------------------- ### Start Barcode Scanning Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Initiates barcode detection using the device's camera. Implement the `BarcodeRecognitionDelegate` to receive detected barcodes. ```swift /// Use this function to detect barcodes by pointing the camera at a barcode /// - Parameters: /// - recognitionDelegate: ``BarcodeRecognitionDelegate``, Add self to implement the BarcodeRecognitionDelegate /// - completion: If success, it will return array of `BarcodeCandidate` objects public func startBarcodeScanning(recognitionDelegate: BarcodeRecognitionDelegate, completion: @escaping (Bool) -> Void) { coreSDK.startBarcodeScanning(recognitionDelegate: recognitionDelegate, completion: completion) } ``` -------------------------------- ### Configure SDK to Use Only Latest Models Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Set `onlyUseLatestModels` to true in `PassioConfiguration` to prevent the SDK from using previously installed models. ```swift public struct PassioConfiguration : Equatable { /// Only use latest models. Don't use models previously installed. public var onlyUseLatestModels = false } ``` -------------------------------- ### Initialize PassioNutrients from reference nutrients Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Create a PassioNutrients object using a reference PassioNutrients object and an optional weight. Defaults to 100 grams if weight is not specified. ```swift public init(referenceNutrients: PassioNutritionAISDK.PassioNutrients, weight: Measurement = Measurement(value: 100.0, unit: .grams)) ``` -------------------------------- ### BarcodeRecognitionDelegate Protocol Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Delegate protocol for receiving barcode recognition results. It is used when starting barcode scanning. ```Swift /// Implement the BarcodeRecognitionDelegate protocol to receive delegate method from the startBarcodeScanning public protocol BarcodeRecognitionDelegate : AnyObject { /// Delegate function for food recognition /// - Parameters: /// - candidates: Barcode candidates if available func recognitionResults(barcodeCandidates: [any PassioNutritionAISDK.BarcodeCandidate]?) } ``` -------------------------------- ### PassioNutritionAI.configure Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Configures the Passio SDK with the provided configuration and returns the SDK status upon completion. ```APIDOC ## PassioNutritionAI.configure ### Description Initializes and configures the Passio SDK. This method requires a `PassioConfiguration` object, which must include your developer key. A completion handler is provided to receive the SDK's status after configuration. ### Method `configure(passioConfiguration: PassioNutritionAISDK.PassioConfiguration, completion: @escaping (PassioNutritionAISDK.PassioStatus) -> Void)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **passioConfiguration** (`PassioNutritionAISDK.PassioConfiguration`) - Required - Your desired configuration, including your developer key. ### Completion Handler - **completion**: `(PassioNutritionAISDK.PassioStatus) -> Void` - A closure that is called with the `PassioStatus` of the SDK after configuration. ``` -------------------------------- ### Get Icon URL API Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md New API to retrieve the icon URL for a given PassioID and size. ```swift /// Get the icon URL /// - Parameters: /// - passioID: passioID /// - size: IconSize (.px90, .px180 or .px360) where .px90 is the default /// - Returns: Optional URL public func iconURLFor(passioID: PassioNutritionAISDK.PassioID, size: PassioNutritionAISDK.IconSize = IconSize.px90) -> URL? ``` -------------------------------- ### fetchMealPlans(completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Fetches a list of all available meal plans. ```APIDOC ## fetchMealPlans(completion:) ### Description Gets a list of all meal plans. ### Response #### Success Response - **completion** (`[PassioMealPlan]`) - A list of `PassioMealPlan` objects. ``` -------------------------------- ### CapturingDeviceType.defaultCapturing Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Gets the default capturing device type. This is a convenient method for obtaining a commonly used camera device. ```APIDOC ## CapturingDeviceType.defaultCapturing ### Description Gets the default capturing device type. This is a convenient method for obtaining a commonly used camera device. ### Method static func ### Parameters None ### Request Example ```swift let defaultDevice = PassioNutritionAISDK.CapturingDeviceType.defaultCapturing() ``` ### Response #### Success Response - **PassioNutritionAISDK.CapturingDeviceType** - The default capturing device type. #### Response Example ```json "builtInWideAngleCamera" ``` ``` -------------------------------- ### PassioFoodMetadata Initializer Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Initializes a new PassioFoodMetadata instance with optional food origin, barcode, ingredients description, tags, and concerns. ```swift public init(foodOrigins: [PassioNutritionAISDK.PassioFoodOrigin]? = nil, barcode: PassioNutritionAISDK.Barcode? = nil, ingredientsDescription: String? = nil, tags: [String]? = nil, concerns: [Int]? = nil) ``` -------------------------------- ### PassioNutrients Initializers Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Initializers for creating PassioNutrients objects. These allow for creation with specific nutrient values, a reference nutrient set, or ingredient data. ```APIDOC ## Initializers ### `init(fat: Measurement?, satFat: Measurement?, monounsaturatedFat: Measurement?, polyunsaturatedFat: Measurement?, proteins: Measurement?, carbs: Measurement?, calories: Measurement?, cholesterol: Measurement?, sodium: Measurement?, fibers: Measurement?, transFat: Measurement?, sugars: Measurement?, sugarsAdded: Measurement?, alcohol: Measurement?, iron: Measurement?, vitaminC: Measurement?, vitaminA: Double?, vitaminA_RAE: Measurement?, vitaminD: Measurement?, vitaminB6: Measurement?, vitaminB12: Measurement?, vitaminB12Added: Measurement?, vitaminE: Measurement?, vitaminEAdded: Measurement?, iodine: Measurement?, calcium: Measurement?, potassium: Measurement?, magnesium: Measurement?, phosphorus: Measurement?, sugarAlcohol: Measurement?, zinc: Measurement?, selenium: Measurement?, folicAcid: Measurement?, chromium: Measurement?, vitaminKPhylloquinone: Measurement?, vitaminKMenaquinone4: Measurement?, vitaminKDihydrophylloquinone: Measurement?, weight: Measurement = Measurement(value: 100.0, unit: .grams)) Initializes a PassioNutrients object with detailed nutrient information and an optional weight. ### `init(referenceNutrients: PassioNutritionAISDK.PassioNutrients, weight: Measurement = Measurement(value: 100.0, unit: .grams)) Initializes a PassioNutrients object using a reference PassioNutrients object and an optional weight. ### `init(ingredientsData: [(PassioNutritionAISDK.PassioNutrients, Double)], weight: Measurement) Initializes a PassioNutrients object from an array of ingredient data, where each element is a tuple containing PassioNutrients and a Double representing a multiplier, along with a specified weight. ``` -------------------------------- ### Configure Nutrition Advisor API Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Use this method to configure the Nutrition Advisor with a license key. The completion handler provides the status of the configuration. ```swift /// Use this method to configure Nutrition Advisor /// - Parameters: /// - licenceKey: Licence Key for configuration /// - completion: NutritionAdvisorResult with sucess or error message public func configure(licenceKey: String, completion: @escaping NutritionAdvisorStatus) ``` -------------------------------- ### PassioMetadataService Get Label Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Retrieves the label for a given PassioID and an optional language code. Defaults to 'en' if no language code is provided. ```swift public func getLabel(passioID: PassioNutritionAISDK.PassioID, languageCode: String = "en") -> String? ``` -------------------------------- ### Initialize PassioNutrients with all optional nutrient values Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Use this initializer to create a PassioNutrients object by providing optional measurements for a comprehensive set of nutrients. Defaults to 100 grams if weight is not specified. ```swift public init(fat: Measurement? = nil, satFat: Measurement? = nil, monounsaturatedFat: Measurement? = nil, polyunsaturatedFat: Measurement? = nil, proteins: Measurement? = nil, carbs: Measurement? = nil, calories: Measurement? = nil, cholesterol: Measurement? = nil, sodium: Measurement? = nil, fibers: Measurement? = nil, transFat: Measurement? = nil, sugars: Measurement? = nil, sugarsAdded: Measurement? = nil, alcohol: Measurement? = nil, iron: Measurement? = nil, vitaminC: Measurement? = nil, vitaminA: Double? = nil, vitaminA_RAE: Measurement? = nil, vitaminD: Measurement? = nil, vitaminB6: Measurement? = nil, vitaminB12: Measurement? = nil, vitaminB12Added: Measurement? = nil, vitaminE: Measurement? = nil, vitaminEAdded: Measurement? = nil, iodine: Measurement? = nil, calcium: Measurement? = nil, potassium: Measurement? = nil, magnesium: Measurement? = nil, phosphorus: Measurement? = nil, sugarAlcohol: Measurement? = nil, zinc: Measurement? = nil, selenium: Measurement? = nil, folicAcid: Measurement? = nil, chromium: Measurement? = nil, vitaminKPhylloquinone: Measurement? = nil, vitaminKMenaquinone4: Measurement? = nil, vitaminKDihydrophylloquinone: Measurement? = nil, weight: Measurement = Measurement(value: 100.0, unit: .grams)) ``` -------------------------------- ### Enum RawValue Property Example Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Illustrates accessing the raw value of an enum instance. This is used to retrieve the string representation of a specific enum case. ```swift enum PaperSize: String { case A4, A5, Letter, Legal } let selectedSize = PaperSize.Letter print(selectedSize.rawValue) // Prints "Letter" print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!) // Prints "true" ``` -------------------------------- ### PassioNutritionAI.shared Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Provides access to the shared singleton instance of the PassioNutritionAI SDK. ```APIDOC ## PassioNutritionAI.shared ### Description Provides access to the shared singleton instance of the PassioNutritionAI SDK. This is the primary entry point for interacting with the SDK's functionalities. ### Usage ```swift let sdk = PassioNutritionAISDK.PassioNutritionAI.shared ``` ``` -------------------------------- ### FoodDetectionConfiguration Initialization Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Initializes FoodDetectionConfiguration with default or custom settings for visual, barcode, and packaged food detection. ```swift public init(detectVisual: Bool = true, detectBarcodes: Bool = false, detectPackagedFood: Bool = false) ``` -------------------------------- ### CapturingDeviceType Photos Device Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Gets the recommended capturing device type specifically for taking photos, with options for position and session preset. This ensures optimal camera settings for image capture. ```swift public static func getCapturingDeviceForPhotos(for position: AVCaptureDevice.Position = .back, preset: AVCaptureSession.Preset = .photo) -> PassioNutritionAISDK.CapturingDeviceType ``` -------------------------------- ### getSupportedDevice Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Retrieves a list of supported capturing devices for image processing, with optional parameters for device position and session preset. ```APIDOC ## getSupportedDevice ### Description Retrieves a list of supported capturing devices for image processing, with optional parameters for device position and session preset. ### Method Swift Function ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **position** (AVCaptureDevice.Position) - The desired position of the camera device (e.g., front or back). Defaults to `.unspecified`. - **preset** (AVCaptureSession.Preset) - The capture session preset that defines the desired video quality and frame rate. Defaults to `.high`. ### Returns - **[CapturingDeviceType]** - An array of `CapturingDeviceType` representing the supported devices. ### Example ```swift let supportedDevices = getSupportedDevice(position: .front, preset: .medium) ``` ``` -------------------------------- ### PassioFoodItemData Initializer Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Initializes a new instance of PassioFoodItemData using UPC product information. ```swift public init(upcProduct: PassioNutritionAISDK.UPCProduct) ``` -------------------------------- ### Initialize PassioNutrients from ingredient data Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Construct a PassioNutrients object from an array of tuples, where each tuple contains PassioNutrients and a Double representing a proportion. The weight is a required parameter. ```swift public init(ingredientsData: [(PassioNutritionAISDK.PassioNutrients, Double)], weight: Measurement) ``` -------------------------------- ### PassioNutritionAI.startBarcodeScanning Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Initiates barcode scanning using the device's camera, with results reported via a delegate. ```APIDOC ## PassioNutritionAI.startBarcodeScanning ### Description Starts the process of detecting barcodes by continuously analyzing the camera feed. Implement the `BarcodeRecognitionDelegate` to receive detected barcode information. A boolean completion indicates if the scanning process was successfully initiated. ### Method `startBarcodeScanning(recognitionDelegate: any PassioNutritionAISDK.BarcodeRecognitionDelegate, completion: @escaping (Bool) -> Void)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **recognitionDelegate**: `any PassioNutritionAISDK.BarcodeRecognitionDelegate` - Required - The delegate object that will receive barcode recognition events. ### Completion Handler - **completion**: `(Bool) -> Void` - A closure that is called with `true` if barcode scanning was successfully started, `false` otherwise. ``` -------------------------------- ### fetchIngridients Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Fetches ingredients based on a previous advisor response. It requires a PassioAdvisorResponse and a completion handler. ```APIDOC ## fetchIngridients ### Description Fetches ingredient information based on a provided advisor response. This method takes a `PassioAdvisorResponse` object and a completion handler that will deliver a `NutritionAdvisorResponse`. ### Method `fetchIngridients(from advisorResponse: PassioNutritionAISDK.PassioAdvisorResponse, completion: @escaping PassioNutritionAISDK.NutritionAdvisorResponse)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **advisorResponse** (PassioNutritionAISDK.PassioAdvisorResponse) - The advisor response object used to fetch ingredients. - **completion** (@escaping PassioNutritionAISDK.NutritionAdvisorResponse) - A closure that handles the response containing ingredient information. ``` -------------------------------- ### Generate Meal Plan Preview Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Generates a preview of a meal plan based on user input, such as a food item or ingredient list. This provides a glimpse of the potential meal plan. ```swift /// Generates a meal plan preview for the user based on the provided input /// - Parameters: /// - request: The food item or ingredient list to generate a meal plan preview for /// - completion: ``PassioGeneratedMealPlan`` public func generateMealPlanPreview(request: String, completion: @escaping (Result) -> Void) { coreSDK.generateMealPlanPreview(request: request, completion: completion) } ``` -------------------------------- ### Fetch Meal Plans and Daily Meal Plan Items Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Provides methods to retrieve all available meal plans and specific meal plan details for a given day. These are essential for meal planning features. ```Swift public func fetchMealPlans(completion: @escaping ([PassioNutritionAISDK.PassioMealPlan]) -> Void) public func fetchMealPlanForDay(mealPlanLabel: String, day: Int, completion: @escaping ([PassioNutritionAISDK.PassioMealPlanItem]) -> Void) ``` -------------------------------- ### Handle Download Completion Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Delegate method called when all SDK files have finished downloading. Provides local URLs for the downloaded files. ```swift completedDownloadingAllFiles(filesLocalURLs: [PassioNutritionAISDK.FileLocalURL]) ``` -------------------------------- ### fetchPossibleIngredients Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Returns possible ingredients for a given food item. ```APIDOC ## fetchPossibleIngredients ### Description Returns possible ingredients for a given food item. ### Method Signature `public func fetchPossibleIngredients(foodName: String, completion: @escaping PassioNutritionAISDK.NutritionAdvisorIngredientsResponse)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **foodName** (String) - Food name to search for. - **completion** (PassioNutritionAISDK.NutritionAdvisorIngredientsResponse) - Callback that returns a `NutritionAdvisorIngredientsResponse`. If successful, it contains an array of `PassioAdvisorFoodInfo` representing possible ingredients. ``` -------------------------------- ### fetchSuggestions(mealTime:completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Retrieves food suggestions tailored for a specific meal time (breakfast, lunch, dinner, or snack). ```APIDOC ## fetchSuggestions(mealTime:completion:) ### Description Gets suggestions for a particular meal time. ### Parameters #### Path Parameters - **mealTime** (`PassioMealTime`) - Required - The meal time for which to fetch suggestions (e.g., .breakfast, .lunch, .dinner, .snack). ### Response #### Success Response - **completion** (`[PassioFoodDataInfo]`) - A list of suggested `PassioFoodDataInfo` objects. ``` -------------------------------- ### startBarcodeScanning Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Initiates barcode detection by using the device's camera. This function allows the application to scan and recognize barcodes in real-time. ```APIDOC ## startBarcodeScanning ### Description Initiates barcode detection by using the device's camera. This function allows the application to scan and recognize barcodes in real-time. ### Method N/A (Swift function) ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift startBarcodeScanning(recognitionDelegate: self) { (success) in // Handle success or failure } ``` ### Response #### Success Response - **completion** (Bool) - Indicates whether the barcode scanning was successfully started. ``` -------------------------------- ### New SSD Foods in V1.3.5 Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotesForModels.md Lists newly included food items recognized by the SSD model in version 1.3.5. ```text VEG0270 | raw enoki mushrooms VEG0581 | zucchini ribbons ``` -------------------------------- ### generateMealPlanPreview Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Generates a preview of a meal plan based on user-provided input. This allows users to see a summary of a potential meal plan before full generation. ```APIDOC ## generateMealPlanPreview ### Description Generates a preview of a meal plan based on user-provided input. This allows users to see a summary of a potential meal plan before full generation. ### Method N/A (Swift function) ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift generateMealPlanPreview(request: "User wants a vegan meal plan") { (result) in // Handle PassioGeneratedMealPlan } ``` ### Response #### Success Response - **completion** (Result) - Contains either a PassioGeneratedMealPlan object or an Error. ``` -------------------------------- ### fetchIconFor(passioID:size:completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Asynchronously fetches an icon image from the web for a given PassioID and size. ```APIDOC ## fetchIconFor(passioID:size:completion:) ### Description Fetches icons from the web. ### Parameters #### Path Parameters - **passioID** (`PassioID`) - Required - The `PassioID` for which to fetch the icon. - **size** (`IconSize`) - Optional - The desired size of the icon. Defaults to `.px90`. Possible values: `.px90`, `.px180`, `.px360`. ### Response #### Success Response - **completion** (`UIImage?`) - An optional `UIImage` representing the food icon. ``` -------------------------------- ### Fetch Quick Food Suggestions Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md This method fetches quick food suggestions based on the specified meal time. It's useful for providing users with rapid food search options. ```Swift public func fetchSuggestions(mealTime: MealTime, completion: @escaping ([PassioSearchResult]) -> Void) ``` -------------------------------- ### PassioGeneratedMealPlanPreview Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md A preview of a generated meal plan, including its constraints and a day-by-day preview of meals. ```APIDOC ## PassioGeneratedMealPlanPreview ### Description Provides a preview of a generated meal plan. It includes the plan's constraints and a preview of the meal breakdown for each day. ### Properties - `constraints`: Optional `PassioGeneratedMealPlanConstraints` that were applied to the plan. - `mealPlanDays`: An array of `PassioGeneratedMealPlanDayPreview` offering a summary of each day's meals. ``` -------------------------------- ### PassioMetadataService Initialization Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Initializes the PassioMetadataService with an optional metadata URL. This service provides access to model names and label icons. ```swift public init(metatadataURL: URL? = nil) ``` -------------------------------- ### PassioNutritionAI.statusDelegate Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Delegate for tracking changes in Passio SDK status. ```APIDOC ## PassioNutritionAI.statusDelegate ### Description Assign a delegate to this property to receive updates on the `PassioStatus` changes. The same status updates are also provided via the `configure` function's completion handler. ### Property - `statusDelegate`: `weak var` - An object conforming to `PassioNutritionAISDK.PassioStatusDelegate`. ``` -------------------------------- ### Initialize Nutrition Facts Decoder Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Initializes the `PassioNutritionFacts` object, which is used to decipher Nutrition Facts tables on packaged food. ```swift public init() ``` -------------------------------- ### PassioNutritionAI.accountDelegate Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Delegate for tracking account usage updates, including token budget information. ```APIDOC ## PassioNutritionAI.accountDelegate ### Description Assign a delegate to this property to receive updates regarding account usage, specifically `PassioTokenBudget`. This allows monitoring of total monthly tokens, used tokens, and the token cost of the last request. ### Property - `accountDelegate`: `weak var` - An object conforming to `PassioNutritionAISDK.PassioAccountDelegate`. ``` -------------------------------- ### fetchMealPlanForDay(mealPlanLabel:day:completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Retrieves the meal plan for a specific day, identified by a meal plan label. ```APIDOC ## fetchMealPlanForDay(mealPlanLabel:day:completion:) ### Description Fetches the meal plan for the specified day. ### Parameters #### Path Parameters - **mealPlanLabel** (`String`) - Required - The label or type of the meal plan. - **day** (`Int`) - Required - The day for which the meal plan is needed. ### Response #### Success Response - **completion** (`[PassioMealPlanItem]`) - A list of `PassioMealPlanItem` objects for the specified day. ``` -------------------------------- ### New SSD Foods in V1.4.0 Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotesForModels.md Lists newly included food items recognized by the SSD model in version 1.4.0. ```text MEA0004 | sunny side up fried eggs MEA2004 | sunny side down eggs ``` -------------------------------- ### fetchFoodItemFor(passioID:completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Fetches detailed food item information for a given PassioID asynchronously. ```APIDOC ## fetchFoodItemFor(passioID:completion:) ### Description Retrieves detailed information about a food item using its PassioID. This operation is performed asynchronously. ### Parameters - **passioID** (PassioNutritionAISDK.PassioID) - The unique identifier for the food item. - **completion** (@escaping (PassioNutritionAISDK.PassioFoodItem?) -> Void) - A closure that is called with the fetched ``PassioFoodItem`` or nil if not found or an error occurred. ### Returns ``PassioFoodItem``? - The detailed information for the food item, or nil. ### Method `public func fetchFoodItemFor(passioID: PassioNutritionAISDK.PassioID, completion: @escaping (PassioNutritionAISDK.PassioFoodItem?) -> Void)` ``` -------------------------------- ### Handle Single File Download Completion Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Delegate method called after a single file has been downloaded. Reports the local URL of the downloaded file and the number of files remaining. ```swift completedDownloadingFile(fileLocalURL: PassioNutritionAISDK.FileLocalURL, filesLeft: Int) ``` -------------------------------- ### Control Flashlight with Passio SDK Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Use the enableFlashlight function to turn the device's flashlight on or off, and adjust the illumination level. ```swift /// Use this method to turn Flashlight on/off. /// - Parameters: /// - enabled: Pass true to turn flashlight on or pass false to turn in off. /// - torchLevel: Sets the illumination level when in Flashlight mode. This value must be a floating-point number between 0.0 and 1.0. public func enableFlashlight(enabled: Bool, level torchLevel: Float) ``` -------------------------------- ### setMLComputeUnits(units:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Sets the machine learning compute units for the SDK. Beta feature, recommended to use the default value (.cpuAndGPU). ```APIDOC ## setMLComputeUnits(units:) ### Description Beta feature: Passio recommends not to change this value. The default is `.cpuAndGPU`. ### Parameters #### Path Parameters - **units** (`MLComputeUnits`) - Required - The compute units to set for ML processing. ``` -------------------------------- ### PassioGeneratedMealPlanRecipePreview Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md A preview of a recipe within a meal plan, indicating its name and whether it was rejected. ```APIDOC ## PassioGeneratedMealPlanRecipePreview ### Description Provides a preview of a recipe in the meal plan, showing its name and a flag indicating if the recipe was rejected. ### Properties - `name`: The name of the recipe. - `rejected`: A boolean value indicating whether the recipe was rejected. ``` -------------------------------- ### fetchFoodItemFor(foodDataInfo:servingQuantity:servingUnit:completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Fetches a PassioFoodItem based on provided food data information, serving quantity, and serving unit. It allows for detailed retrieval of food item specifics. ```APIDOC ## fetchFoodItemFor(foodDataInfo:servingQuantity:servingUnit:completion:) ### Description Fetches a `PassioFoodItem` for given `PassioFoodDataInfo` and servingQuantity and servingUnit. ### Parameters #### Path Parameters - **foodDataInfo** (`PassioFoodDataInfo`) - Required - Information about the food data. - **servingQuantity** (`Double?`) - Optional - The serving quantity to set in `PassioFoodItem`. - **servingUnit** (`String?`) - Optional - The serving unit to set in `PassioFoodItem`. ### Response #### Success Response - **completion** (`PassioFoodItem?`) - The fetched `PassioFoodItem` or nil if not found. ``` -------------------------------- ### CapturingDeviceType Supported Devices Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md This static function returns an array of supported capturing device types for a given position and session preset. It helps in selecting the appropriate camera hardware for specific use cases. ```swift public static func supportedDeviceTypes(for position: AVCaptureDevice.Position = .unspecified, preset: AVCaptureSession.Preset = .high) -> [PassioNutritionAISDK.CapturingDeviceType] ``` -------------------------------- ### PassioConfiguration Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Configuration struct for the Passio SDK. It allows setting up API keys, file URLs, download preferences, and other operational parameters. ```APIDOC ## Struct PassioConfiguration ### Description Configuration struct for the Passio SDK. It allows setting up API keys, file URLs, download preferences, and other operational parameters. ### Properties - **key** (String) - Required - The API key received from Passio. A valid key must be used. - **filesLocalURLs** ([PassioNutritionAISDK.FileLocalURL]?) - Optional - Local URLs for SDK files if they are not included with the SDK. - **sdkDownloadsModels** (Bool) - Optional - If true, the SDK will download relevant models from Passio's bucket. - **remoteOnly** (Bool) - Optional - If true, the SDK will not download ML models, limiting functionality to Barcode and NutritionFacts. - **debugMode** (Int) - Optional - Set to 1 for increased debugging information. - **allowInternetConnection** (Bool) - Optional - If false, the SDK will not connect to the internet for key validations, barcode data, or packaged food data. - **bridge** (PassioNutritionAISDK.Bridge) - Optional - Specify if the SDK is being bridged via ReactNative or Flutter. - **proxyUrl** (String?) - Optional - The base URL of the target proxy endpoint. - **proxyHeaders** ([String: String]?) - Optional - Headers to be included in all requests. ### Initializers - **init(key: String = "")** - Initializes PassioConfiguration with an optional key. ``` -------------------------------- ### generateMealPlan Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Generates a meal plan based on user-provided input, such as a list of food items or ingredients. Returns a detailed meal plan. ```APIDOC ## generateMealPlan ### Description Generates a meal plan based on user-provided input, such as a list of food items or ingredients. Returns a detailed meal plan. ### Method N/A (Swift function) ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift generateMealPlan(request: "Ingredients: chicken, rice, broccoli") { (result) in // Handle PassioGeneratedMealPlan } ``` ### Response #### Success Response - **completion** (Result) - Contains either a PassioGeneratedMealPlan object or an Error. ``` -------------------------------- ### fetchFoodItemFor(refCode:completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Fetches detailed food item information using a reference code asynchronously. ```APIDOC ## fetchFoodItemFor(refCode:completion:) ### Description Retrieves detailed information about a food item using its reference code. This operation is performed asynchronously. ### Parameters - **refCode** (String) - The reference code for the food item. - **completion** (@escaping (PassioNutritionAISDK.PassioFoodItem?) -> Void) - A closure that is called with the fetched ``PassioFoodItem`` or nil if not found or an error occurred. ### Returns ``PassioFoodItem``? - The detailed information for the food item, or nil. ### Method `public func fetchFoodItemFor(refCode: String, completion: @escaping (PassioNutritionAISDK.PassioFoodItem?) -> Void)` ``` -------------------------------- ### PassioGeneratedMealPlanDayPreview Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Provides a preview of a day's meals within a generated meal plan, focusing on recipe names and rejection status. ```APIDOC ## PassioGeneratedMealPlanDayPreview ### Description Offers a preview of the meals for a specific day in a meal plan, including breakfast, lunch, dinner, and snacks. It focuses on recipe names and whether a recipe was rejected. ### Properties - `breakfast`: An array of `PassioGeneratedMealPlanRecipePreview` for breakfast. - `lunch`: An array of `PassioGeneratedMealPlanRecipePreview` for lunch. - `dinner`: An array of `PassioGeneratedMealPlanRecipePreview` for dinner. - `snack`: An array of `PassioGeneratedMealPlanRecipePreview` for snacks. ``` -------------------------------- ### Update Product Localization Header Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Use this method to set the `Passio-Product-Localization` header, controlling the language/region for product search results. It localizes product names, descriptions, and leverages region-specific semantic search tools. Accepts BCP47 language tags or ISO 639-1 language codes. ```swift /// Use this method to set the `Passio-Product-Localization` header. /// Controls the language/region for product search results. Used to localize product names, descriptions, /// and leverage region-specific semantic search tools. /// /// - Parameters: /// - localizationCode: Accepts BCP47 language tags or ISO 639-1 language codes (e.g., `"en"` for English, `"fr"` for French, `"de"` for German). /// - Returns: A Boolean value indicating whether the localization setting was applied successfully. /// /// ### Format /// Accepts BCP47 language tags or ISO 639-1 language codes: /// - `en-US` - English (United States) /// - `en-GB` - English (United Kingdom) /// - `ja-JP` - Japanese (Japan) /// - `es-MX` - Spanish (Mexico) /// - `fr-FR` - French (France) /// - `de-DE` - German (Germany) /// Or just language codes: `en`, `ja`, `es`, `fr`, `de`. /// /// ### What It Does /// - **Regional Semantic Search**: If a region-specific semantic search tool exists (e.g., `semantic_search_ja-jp`), it will be used automatically. /// - **Translation**: Response will be translated to the target language if different from source. /// - **Regional Preferences**: Results may be optimized for the specified region. /// /// ### Example /// ```swift /// setProductLocalizationHeader(localizationCode: "en-US") /// ``` @discardableResult public func updateProductLocalization(localizationCode: String?) -> Bool { coreSDK.updateProductLocalization(localizationCode: localizationCode) } ``` -------------------------------- ### PassioNutritionAI.requestCompressedFiles Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Controls whether the SDK requests compressed files for faster download and slower processing, or non-compressed files for slower download and faster processing. ```APIDOC ## PassioNutritionAI.requestCompressedFiles ### Description Determines the file compression setting for SDK data. Setting this to `true` (default) prioritizes faster downloads at the cost of slower processing. Setting it to `false` results in slower downloads but faster processing. ### Property - `requestCompressedFiles`: `Bool` - `true` for compressed files (default), `false` for non-compressed files. ``` -------------------------------- ### AVCaptureViedeoPreviewView Class Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Provides a preview of the video capture. It includes methods for layout updates and deinitialization. ```Swift import AVFoundation import Accelerate import CommonCrypto import CoreML import CoreMedia import CoreMotion import DeveloperToolsSupport import Foundation import MLCompute import Metal import MetalPerformanceShaders import SQLite3 import SwiftUI import UIKit import VideoToolbox import Vision import simd @MainActor @objc @preconcurrency public class AVCaptureViedeoPreviewView : UIView { @MainActor @preconcurrency override dynamic public func layoutSubviews() @objc deinit } ``` -------------------------------- ### fetchFoodItemFor(productCode:completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Fetches a PassioFoodItem from the Passio web-service using a product code (barcode). ```APIDOC ## fetchFoodItemFor(productCode:completion:) ### Description Fetches from Passio web-service the `PassioFoodItem` for a product code. ### Parameters #### Path Parameters - **productCode** (`String`) - Required - The product code (barcode) of the food item. ### Response #### Success Response - **completion** (`PassioFoodItem?`) - The fetched `PassioFoodItem` or nil if not found. ``` -------------------------------- ### Fetch Visual Alternatives for a Food Item Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Find visual alternatives for a given food item using the fetchVisualAlternatives API. The results are provided via a completion handler as an array of PassioAdvisorFoodInfo or an error. ```swift /// Returns visual alternatives for a given food item /// - Parameters: /// - foodName: Food name to search for /// - completion: NutritionAdvisor responds with a success or error response. If the response is successful, you will receive an array of ``PassioAdvisorFoodInfo`` visual alternatives for the searched for food item. public func fetchVisualAlternatives( foodName: String, completion: @escaping NutritionAdvisorIngredientsResponse ) ``` -------------------------------- ### Initiate Conversation with Nutrition Advisor API Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Initiates a conversation with the Nutrition Advisor. The completion handler provides the status of the conversation initiation. ```swift /// Initiate converstion with Nutrition Advisor /// - Parameters: /// - completion: NutritionAdvisorResult with sucess or error message public func initConversation(completion: @escaping NutritionAdvisorStatus) ``` -------------------------------- ### Fetch Ingredients from Nutrition Advisor Response Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Fetches ingredients from a PassioAdvisorResponse. The completion handler returns a PassioAdvisorResponse containing food information upon success. ```swift /// Use this method to fetch ingredients /// - Parameters: /// - advisorResponse: Pass PassioAdvisorResponse /// - completion: NutritionAdvisor responds with a success or error response. If the response is successful, you will receive PassioAdvisorResponse containing food information. public func fetchIngridients(from advisorResponse: PassioAdvisorResponse, completion: @escaping NutritionAdvisorResponse) ``` -------------------------------- ### PassioFoodItemData Methods Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Provides methods for initializing and modifying food item data, including setting serving sizes and units. ```APIDOC ## PassioFoodItemData Methods ### Description Methods for initializing and manipulating food item data. ### Methods - **setFoodItemDataServingSize(unit: String, quantity: Double)** -> Bool: Sets the serving size for the food item data. - **setServingUnitKeepWeight(unitName: String)** -> Bool: Sets the serving unit while retaining the weight. - **init(upcProduct: PassioNutritionAISDK.UPCProduct)**: Initializes a PassioFoodItemData instance with UPC product information. - **== (a: PassioNutritionAISDK.PassioFoodItemData, b: PassioNutritionAISDK.PassioFoodItemData)** -> Bool: Compares two PassioFoodItemData instances for equality. - **encode(to encoder: any Encoder) throws**: Encodes the instance into a given encoder. - **init(from decoder: any Decoder) throws**: Creates a new instance by decoding from a given decoder. ``` -------------------------------- ### CapturingDeviceType All Cases Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Provides a collection of all possible CapturingDeviceType values. This is part of the CaseIterable conformance, useful for iterating through all available camera types. ```swift nonisolated public static var allCases: [PassioNutritionAISDK.CapturingDeviceType] { get } ``` -------------------------------- ### Generate Meal Plan Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotes.md Generates a meal plan based on user input, such as a food item or ingredient list. The result includes a generated meal plan. ```swift /// Generates a meal plan for the user based on the provided input /// - Parameters: /// - request: The food item or ingredient list to generate a meal plan for /// - completion: ``PassioGeneratedMealPlan`` public func generateMealPlan(request: String, completion: @escaping (Result) -> Void) { coreSDK.generateMealPlan(request: request, completion: completion) } ``` -------------------------------- ### getPreviewLayerWithGravityView Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Retrieves a PassioNutritionAISDK.AVCaptureViedeoPreviewView with customizable settings, including tap-to-focus functionality. ```APIDOC ## getPreviewLayerWithGravityView ### Description Provides a view for displaying the camera preview with advanced customization options, including session settings, video gravity, and tap-to-focus capability. ### Parameters - **sessionPreset** (AVCaptureSession.Preset) - Defaults to `.hd1920x1080`. The desired session preset for the camera. - **videoGravity** (AVLayerVideoGravity) - Defaults to `.resizeAspectFill`. Determines how the video is scaled and positioned within the view's bounds. - **capturingDeviceType** (PassioNutritionAISDK.CapturingDeviceType) - Defaults to `.defaultCapturing()`. Specifies the type of camera device to use. - **tapToFocusEnabled** (Bool) - Defaults to `false`. Enables or disables tap-to-focus functionality. ### Returns ``PassioNutritionAISDK.AVCaptureViedeoPreviewView``? - An optional view instance for displaying the camera preview with the specified configurations. ### Method `public func getPreviewLayerWithGravityView(sessionPreset: AVCaptureSession.Preset = .hd1920x1080, videoGravity: AVLayerVideoGravity = .resizeAspectFill, capturingDeviceType: PassioNutritionAISDK.CapturingDeviceType = .defaultCapturing(), tapToFocusEnabled: Bool = false) -> PassioNutritionAISDK.AVCaptureViedeoPreviewView?` ``` -------------------------------- ### New Included SSD Foods (V1.0.9) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotesForModels.md List of new food items recognized by the SSD model in version 1.0.9. ```text MEA0072 | ham MEA0074 | bacon MEA0175 | whole sausages MEA2042 | sliced sausages MEA8509 | deli sliced salami PRE0403 | fried rolls PRE0430 | mashed orange vegetables PRE0431 | fried bites PRE0432 | fried rings PRE0433 | fried sticks PRE9599 | fries ``` -------------------------------- ### listFoodEnabledForAmountEstimation Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Lists all foods that are enabled for weight estimations. This function returns an array of PassioIDs representing these foods. ```APIDOC ## listFoodEnabledForAmountEstimation ### Description Lists all foods that are enabled for weight estimations. ### Returns Array of ``PassioID`` ### Method `public func listFoodEnabledForAmountEstimation() -> [PassioNutritionAISDK.PassioID]` ``` -------------------------------- ### New SSD Foods in V1.1.2 Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/ReleaseNotesForModels.md Lists new food items added to the SSD model in version 1.1.2. These are identifiers for food items recognized by the SSD model. ```text NUT0021 | raw peanuts in red skin VEG0355 | sliced carrots VEG0392 | sliced red apples ING0163 | block of butter ING0164 | piece of butter ING0165 | butter spread in open box ING0168 | soft butter ING0171 | whipped butter NUT9093 | crunchy peanuts VEG0252 | sliced green apples VEG6288 | yellow tomatoes VEG6289 | red tomatoes VEG0226 | red beets VEG0296 | golden beets ING0098 | shortening VEG7877 | green tomato VEG2445 | baby tomatoes VEG0402 | sliced peeled apples VEG0529 | orange tomatoes VEG3318 | round apple slices ``` -------------------------------- ### fetchFoodItemLegacy(from:completion:) Source: https://github.com/passiolife/passio-nutrition-ai-ios-sdk-distribution/blob/main/SDK_API.md Fetches a PassioFoodItem using a v2 PassioID. This method is for legacy support. ```APIDOC ## fetchFoodItemLegacy(from:completion:) ### Description Fetches `PassioFoodItem` for a v2 PassioID. ### Parameters #### Path Parameters - **passioID** (`PassioID`) - Required - The v2 PassioID to fetch the food item for. ### Response #### Success Response - **completion** (`PassioFoodItem?`) - An optional `PassioFoodItem` object. ```