diff --git a/RU-Eating.xcodeproj/project.xcworkspace/xcuserdata/alex.xcuserdatad/UserInterfaceState.xcuserstate b/RU-Eating.xcodeproj/project.xcworkspace/xcuserdata/alex.xcuserdatad/UserInterfaceState.xcuserstate index 4857f82..02211b6 100644 Binary files a/RU-Eating.xcodeproj/project.xcworkspace/xcuserdata/alex.xcuserdatad/UserInterfaceState.xcuserstate and b/RU-Eating.xcodeproj/project.xcworkspace/xcuserdata/alex.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/RU-Eating/Models/Settings.swift b/RU-Eating/Models/Settings.swift index 2a600ce..f39df96 100644 --- a/RU-Eating/Models/Settings.swift +++ b/RU-Eating/Models/Settings.swift @@ -24,8 +24,9 @@ class Settings { var systemColorScheme: Bool? var colorScheme: Bool? var lastDiningHall: String + var useHearts: Bool - init(filterIngredients: Bool = false, restrictions: [String] = [], hideRestricted: Bool = false, carbonFootprints: Bool = true, hideZeros: Bool = false, hideNils: Bool = false, extraPercents: Bool = true, fdaDailyValues: Bool = false, systemColorScheme: Bool? = nil, colorScheme: Bool? = nil, lastDiningHall: String = "Busch") { + init(filterIngredients: Bool = false, restrictions: [String] = [], hideRestricted: Bool = false, carbonFootprints: Bool = true, hideZeros: Bool = false, hideNils: Bool = false, extraPercents: Bool = true, fdaDailyValues: Bool = false, systemColorScheme: Bool? = nil, colorScheme: Bool? = nil, lastDiningHall: String = "Busch", useHearts: Bool = false) { self.filterIngredients = filterIngredients self.hideRestricted = hideRestricted self.restrictions = restrictions @@ -39,6 +40,7 @@ class Settings { self.systemColorScheme = systemColorScheme self.colorScheme = colorScheme self.lastDiningHall = lastDiningHall + self.useHearts = useHearts } func favorite(item: Item) { diff --git a/RU-Eating/Views/ItemNavigationLink.swift b/RU-Eating/Views/ItemNavigationLink.swift index e9173b0..0030413 100644 --- a/RU-Eating/Views/ItemNavigationLink.swift +++ b/RU-Eating/Views/ItemNavigationLink.swift @@ -20,8 +20,14 @@ struct ItemNavigationLink : View { Text(viewModel.item.name) } icon: { if viewModel.item.isFavorite { - Image(systemName: "star.fill") - .foregroundStyle(.yellow) + if settings.useHearts { + Image(systemName: "heart.fill") + .foregroundStyle(.pink) + } + else { + Image(systemName: "star.fill") + .foregroundStyle(.yellow) + } } else if (settings.filterIngredients && viewModel.containsRestrictions) { Image(systemName: "exclamationmark.triangle.fill") @@ -62,9 +68,15 @@ struct ItemNavigationLink : View { } .swipeActions { Button(action: { settings.favorite(item: viewModel.item) }) { - Image(systemName: viewModel.item.isFavorite ? "star.slash.fill" : "star.fill") + if settings.useHearts { + Image(systemName: viewModel.item.isFavorite ? "heart.slash.fill" : "heart.fill") + .tint(.pink) + } + else { + Image(systemName: viewModel.item.isFavorite ? "star.slash.fill" : "star.fill") + .tint(.yellow) + } } - .tint(.yellow) } } } diff --git a/RU-Eating/Views/ItemView.swift b/RU-Eating/Views/ItemView.swift index d0fe716..56b7d0b 100644 --- a/RU-Eating/Views/ItemView.swift +++ b/RU-Eating/Views/ItemView.swift @@ -53,8 +53,14 @@ struct ItemView: View { ToolbarItem(placement: .topBarTrailing) { // toggle was changing background color, so I use button Button(action: { settings.favorite(item: viewModel.item) }) { - Image(systemName: viewModel.item.isFavorite ? "star.fill" : "star") - .foregroundStyle(.yellow) + if settings.useHearts { + Image(systemName: viewModel.item.isFavorite ? "heart.fill" : "heart") + .foregroundStyle(.pink) + } + else { + Image(systemName: viewModel.item.isFavorite ? "star.fill" : "star") + .foregroundStyle(.yellow) + } } } } diff --git a/RU-Eating/Views/SettingsView.swift b/RU-Eating/Views/SettingsView.swift index 7ddd903..893519b 100644 --- a/RU-Eating/Views/SettingsView.swift +++ b/RU-Eating/Views/SettingsView.swift @@ -31,6 +31,9 @@ struct SettingsView : View { } } } + Toggle(isOn: $viewModel.settings.useHearts) { + Text("Use Hearts for Favorites") + } Toggle(isOn: $viewModel.settings.carbonFootprints) { Text("Carbon Footprints") }