Skip to main content
Version: 5.5

Diet

This template allows you to customize the Diet section of the Preferences page.

import SwiftUI
import mealzcore
import MealziOSSDK

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

Params

public struct PreferencesDietParameters {
/// The differerent types of diet (like Vegetarian)
public let dietsTag: [CheckableTag]
/// Whether or not all options are available to be seen
@Binding public var isExpanded: Bool
/// Boolean indicating if the input is a checkbox (multiple options) or radioButton (one option)
public let typeOfInput: TypeOfInput
/// A closure that selects this diet option. Multiple options can be selected at the same time
public let onTogglePreference: (String) -> Void