Skip to main content
Version: 5.6

RecipeDetailIngredientsAtHomeToggleButton

IngredientsAtHomeToggleButton

To create your own toggle button that programmatically shows the ingredients "already in your pantry", like salt or pepper, you create a class that implements BaseButtonProtocol.

import SwiftUI
import MealziOSSDK

@available(iOS 14, *)
public struct MyCustomButtonView: BaseButtonProtocol {
public func content(params: BaseButtonParameters) -> some View {
// your implementation here
}
}

with

public struct BaseButtonParameters {
/// Text that displays on the button
public let buttonText: String
/// Boolean on whether or not the button has been pressed yet
public let buttonPressed: Bool
/// A closure that executes the function passed in
public let onButtonAction: () -> Void