diff --git a/Caps/ContentView.swift b/Caps/ContentView.swift index 55c905b..0163ace 100644 --- a/Caps/ContentView.swift +++ b/Caps/ContentView.swift @@ -53,7 +53,7 @@ struct ContentView: View { var isEnteringNewCapName = false @State - private var capIdOfNextPhoto: Int? + private var selectedCapId: Int? var filteredCaps: [Cap] { let text = searchString @@ -253,7 +253,7 @@ struct ContentView: View { .sheet(isPresented: $showCameraSheet) { CameraView(isPresented: $showCameraSheet, image: $database.image, - capId: $capIdOfNextPhoto) + capId: $selectedCapId) } .sheet(isPresented: $showSettingsSheet) { SettingsView(isPresented: $showSettingsSheet) @@ -334,13 +334,13 @@ struct ContentView: View { private func didTap(cap: Cap) { guard let image = database.image else { - capIdOfNextPhoto = cap.id + selectedCapId = cap.id openCamera() return } database.save(image, for: cap.id) database.image = nil - capIdOfNextPhoto = nil + selectedCapId = nil } private func saveNewCap() { @@ -356,16 +356,16 @@ struct ContentView: View { private func showRenameWindow(for cap: Cap) { updatedCapName = cap.name - capIdOfNextPhoto = cap.id + selectedCapId = cap.id showUpdateCapNameAlert = true } private func saveNewCapName() { defer { - capIdOfNextPhoto = nil + selectedCapId = nil updatedCapName = "" } - guard let capId = capIdOfNextPhoto else { + guard let capId = selectedCapId else { return } let name = updatedCapName.trimmingCharacters(in: .whitespacesAndNewlines) diff --git a/Caps/Data/Database.swift b/Caps/Data/Database.swift index ae9c412..04b131d 100644 --- a/Caps/Data/Database.swift +++ b/Caps/Data/Database.swift @@ -273,7 +273,7 @@ final class Database: ObservableObject { continue } if changedCaps.contains(oldCap.id) { -#warning("Merge changed caps with server updates") + #warning("Merge changed caps with server updates") } else { oldCap.update(with: cap) let save = oldCap