Skip to content

Commit

Permalink
Undo favorites drag and drop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Bisenius committed May 18, 2024
1 parent f952c9f commit 1065fd7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 0 additions & 2 deletions Calorie Counter/Components/LargeCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ struct LargeCardView: View {
if desiredGoal != 0 {
// Save new goal
UserDefaults.standard.set(desiredGoal, forKey: "\(title.lowercased())Goal")
print("Setting UserDefaults \(title.lowercased())Goal")
print((desiredGoal ?? 0).description)
// Update goal in macro item view immediately without refreshing view
goalState = desiredGoal
}
Expand Down
18 changes: 14 additions & 4 deletions Calorie Counter/Screens/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import SwiftUI
import UniformTypeIdentifiers

struct SettingsView: View {
@State private var caloriesGoal: String = "2,000 calories / day"
Expand All @@ -21,11 +22,20 @@ struct SettingsView: View {
NavigationView {
ScrollView {
VStack(spacing: 20) {

settingsSection(header: "Favorites") {
settingsRow(title: "Calories", imageName: "Bars", lastRow: nil, gray: true, danger: nil)
settingsRow(title: "Weight", imageName: "Bars", lastRow: nil, gray: true, danger: nil)
settingsRow(title: "Macros", imageName: "Bars", lastRow: nil, gray: true, danger: nil)
settingsRow(title: "Meals", imageName: "Bars", lastRow: true, gray: true, danger: nil)
settingsRow(title: "Calories", value: nil, imageName: "Bars", lastRow: nil, gray: true, danger: nil)
/*.onDrag {
print("Dragging item: Calories")
return NSItemProvider()
}*/
settingsRow(title: "Weight", value: nil, imageName: "Bars", lastRow: nil, gray: true, danger: nil)
/*.onDrag {
print("Dragging item: Weight")
return NSItemProvider()
}*/
settingsRow(title: "Macros", value: nil, imageName: "Bars", lastRow: nil, gray: true, danger: nil)
settingsRow(title: "Meals", value: nil, imageName: "Bars", lastRow: true, gray: true, danger: nil)
}

settingsSection(header: "Goals") {
Expand Down
1 change: 0 additions & 1 deletion Calorie Counter/Screens/SummaryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ struct SummaryView: View {
// Fetch calorie goal
let calorieGoal = UserDefaults.standard.integer(forKey: "caloriesGoal")
_calorieGoal = State(initialValue: calorieGoal)
print("Setting calorie goal locally: \(calorieGoal)")
// Fetch weight goal
let weightGoal = UserDefaults.standard.integer(forKey: "weightGoal")
_weightGoal = State(initialValue: weightGoal)
Expand Down

0 comments on commit 1065fd7

Please sign in to comment.