mirror of
https://github.com/NinjaCheetah/RIT-Dining.git
synced 2025-12-02 09:31:35 -05:00
Replaced the icon with a more generic tiger pawprint so that I'm not using an RIT trademark, so that I'm prepared for the first App Store release. Also added information about where menu information is being sourced from on the about screen, and fixed a bug where vegetarian/vegan/no beef/no pork toggles would not be written to UserDefaults.
62 lines
2.1 KiB
Swift
62 lines
2.1 KiB
Swift
//
|
|
// MenuDietaryRestrictionsSheet.swift
|
|
// RIT Dining
|
|
//
|
|
// Created by Campbell on 11/11/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct MenuDietaryRestrictionsSheet: View {
|
|
@Environment(\.dismiss) var dismiss
|
|
@Binding var dietaryRestrictionsModel: MenuDietaryRestrictionsModel
|
|
|
|
var body: some View {
|
|
NavigationView {
|
|
Form {
|
|
Section(header: Text("Diet")) {
|
|
Toggle(isOn: $dietaryRestrictionsModel.noBeef) {
|
|
Text("No Beef")
|
|
}
|
|
Toggle(isOn: $dietaryRestrictionsModel.noPork) {
|
|
Text("No Pork")
|
|
}
|
|
Toggle(isOn: $dietaryRestrictionsModel.isVegetarian) {
|
|
Text("Vegetarian")
|
|
}
|
|
Toggle(isOn: $dietaryRestrictionsModel.isVegan) {
|
|
Text("Vegan")
|
|
}
|
|
}
|
|
Section(header: Text("Allergens")) {
|
|
ForEach(Allergen.allCases, id: \.self) { allergen in
|
|
Toggle(isOn: Binding(
|
|
get: {
|
|
dietaryRestrictionsModel.dietaryRestrictions.contains(allergen)
|
|
},
|
|
set: { isOn in
|
|
if isOn {
|
|
dietaryRestrictionsModel.dietaryRestrictions.add(allergen)
|
|
} else {
|
|
dietaryRestrictionsModel.dietaryRestrictions.remove(allergen)
|
|
}
|
|
}
|
|
)) {
|
|
Text(allergen.rawValue.capitalized)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.navigationTitle("Menu Filters")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
.toolbar {
|
|
Button(action: {
|
|
dismiss()
|
|
}) {
|
|
Image(systemName: "xmark")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|