Skip to main content
Version: 4.0

Link

Mealz provides a parameter categoryId on CatalogResults that show desired categories. It is design to be used with deeplinking. Just pass the catalogId & the title as parameters in your link, you must pass BOTH:

import UIKit
import MealziOSSDK
import MealzUIiOSSDK

// since these are standalone pages that shouldn't be created twice,
// we can create them once here for reuse
public let mealzCatalogFeature = MealzCatalogFeatureUIKit(
recipeDetailsConstructor: MealzViewConfig.recipeDetailsConfig,
catalogFeatureConstructor: MealzViewConfig.catalogConfig,
myMealsViewOptions: MealzViewConfig.myMealsView,
myMealsRecipesListGridConfig: MealzViewConfig.myMealsGridConfig
)

// *your view controller opening the Catalog*
mealzCatalogFeature.openCatalogResults(catalogId: category, categoryTitle: title)
self.present(mealzCatalogFeature, animated: true)
tip

You can find Mealz category IDs on our back office Mealz Partner

You can also use this feature directly in your application. To do so, you'll need to get current active catalog's categories. Here's how you can do that:

import mealzcore

Mealz.shared.catalog.getCatalogCategories { categories in
self.categories.categoriesList = categories
}

Then you can pass it to a component and use it to navigate directly to a category

import SwiftUI
import mealzcore

struct CategoriesMenu: View {

@ObservedObject var category: Categories

var body: some View {
Menu("categories") {
ForEach(category.categoriesList, id: \.self) { cat in
Button(cat.title, action: { /*Do stuff here*/ })
}
}
}
}