Skip to main content
Version: 5.2

CatalogRecipeCard

CatalogRecipeCard

To create your own recipe card template you create a class that implements CatalogRecipeCardProtocol

import SwiftUI
import mealzcore
import MealziOSSDK

@available(iOS 14, *)
public struct MyCustomRecipeCardView: CatalogRecipeCardProtocol {
public func content(params: CatalogRecipeCardParameters) -> some View {
// your imp here
}
}

with

public struct CatalogRecipeCardParameters {
/// The width & height of the recipe card
public var recipeCardDimensions: CGSize
/// The Recipe object of the current Recipe Card
public var recipe: Recipe
/// The price of the Recipe, which updates when it is added to the baket
public var recipePrice: Double
/// The number of guests that are in the recipe
public var numberOfGuests: Int
/// Boolean on whether the Recipe is currently in the basket. This can change the CTA text
public var isCurrentlyInBasket: Bool
/// A closure that executes the function in the "Call To Action" of the recipe card. This is usally "add to basket", so the navigation is to the Basket
public var onAddToBasket: (String) -> Void
/// A closure that opens the RecipeDetails, passing in the recipeId
public var onShowRecipeDetails: (String) -> Void