From 9ae941933d039c0e04250c54fbe96dadfa17b37f Mon Sep 17 00:00:00 2001 From: isiko35 <95910857+isiko35@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:08:01 +0400 Subject: [PATCH 1/4] Add VehicleDetailView for issue #357 Added VehicleDetailView to show vehicle details. Also, any edits could be made through the EditVehicleView connection. Updated SettingsView so that each vehicle is tappable to show VehicleDetailView Updated EditVehicleView so that when a change occur, it optionally notifies the parent view. --- .../project.pbxproj | 17 ++- .../Shared/Localizable.xcstrings | 3 + .../Settings/Views/EditVehicleView.swift | 4 + .../Shared/Settings/Views/SettingsView.swift | 11 ++ .../Settings/Views/VehicleDetailView.swift | 121 ++++++++++++++++++ 5 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 Basic-Car-Maintenance/Shared/Settings/Views/VehicleDetailView.swift diff --git a/Basic-Car-Maintenance.xcodeproj/project.pbxproj b/Basic-Car-Maintenance.xcodeproj/project.pbxproj index 664927af..d975413b 100644 --- a/Basic-Car-Maintenance.xcodeproj/project.pbxproj +++ b/Basic-Car-Maintenance.xcodeproj/project.pbxproj @@ -76,7 +76,6 @@ FF52DEBC2CADE9EF0023F8DE /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { isa = PBXFileSystemSynchronizedBuildFileExceptionSet; membershipExceptions = ( - Shared/Info.plist, Shared/PrivacyInfo.xcprivacy, ); target = FF5D13A22A86C2D600BC9BD6 /* Basic-Car-Maintenance */; @@ -584,6 +583,7 @@ CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Basic-Car-Maintenance/Preview Content\""; + DEVELOPMENT_TEAM = FG6TDFAG29; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -604,6 +604,7 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -625,6 +626,7 @@ CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Basic-Car-Maintenance/Preview Content\""; + DEVELOPMENT_TEAM = FG6TDFAG29; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -645,6 +647,7 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -662,9 +665,11 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; + DEVELOPMENT_TEAM = FG6TDFAG29; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.0; MACOSX_DEPLOYMENT_TARGET = 15.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -683,9 +688,11 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; + DEVELOPMENT_TEAM = FG6TDFAG29; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.0; MACOSX_DEPLOYMENT_TARGET = 15.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -703,9 +710,11 @@ buildSettings = { CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; + DEVELOPMENT_TEAM = FG6TDFAG29; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.0; MACOSX_DEPLOYMENT_TARGET = 15.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.UITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -723,9 +732,11 @@ buildSettings = { CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; + DEVELOPMENT_TEAM = FG6TDFAG29; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.0; MACOSX_DEPLOYMENT_TARGET = 15.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.UITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -744,6 +755,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = FG6TDFAG29; ENABLE_USER_SCRIPT_SANDBOXING = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Basic-Car-Maintenance-Widget/Info.plist"; @@ -755,6 +767,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); + PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.Widget"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -772,6 +785,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = FG6TDFAG29; ENABLE_USER_SCRIPT_SANDBOXING = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Basic-Car-Maintenance-Widget/Info.plist"; @@ -783,6 +797,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); + PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.Widget"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; diff --git a/Basic-Car-Maintenance/Shared/Localizable.xcstrings b/Basic-Car-Maintenance/Shared/Localizable.xcstrings index af06cb38..e3e0fac3 100644 --- a/Basic-Car-Maintenance/Shared/Localizable.xcstrings +++ b/Basic-Car-Maintenance/Shared/Localizable.xcstrings @@ -5528,6 +5528,9 @@ } } }, + "Vehicle Details" : { + "comment" : "Label about vehicle details." + }, "Vehicle License Plate Number" : { "localizations" : { "be" : { diff --git a/Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift b/Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift index a148bcd8..b12757aa 100644 --- a/Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift +++ b/Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift @@ -11,6 +11,7 @@ import SwiftUI struct EditVehicleView: View, Observable { @Binding var selectedVehicle: Vehicle? var viewModel: SettingsViewModel + var onVehicleUpdated: ((Vehicle) -> Void)? @Environment(\.dismiss) var dismiss @@ -98,6 +99,9 @@ struct EditVehicleView: View, Observable { vehicle.id = selectedVehicle.id Task { await viewModel.updateVehicle(vehicle) + if let onVehicleUpdated { + onVehicleUpdated(vehicle) + } dismiss() } } diff --git a/Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift b/Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift index 62ac158d..d614834a 100644 --- a/Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift +++ b/Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift @@ -28,6 +28,8 @@ struct SettingsView: View { @State private var selectedVehicle: Vehicle? @State private var isShowingEditVehicleView = false + @State private var isShowingVehicleDetailView = false + private let appVersion = "Version \(Bundle.main.versionNumber) (\(Bundle.main.buildNumber))" init(authenticationViewModel: AuthenticationViewModel) { @@ -123,6 +125,12 @@ struct SettingsView: View { .font(.callout) .foregroundStyle(.secondary) } + .frame(maxWidth: .infinity, alignment: .leading) + .contentShape(Rectangle()) + .onTapGesture { + selectedVehicle = vehicle + isShowingVehicleDetailView = true + } .swipeActions { Button(role: .destructive) { Task { @@ -232,6 +240,9 @@ struct SettingsView: View { } } } + .navigationDestination(isPresented: $isShowingVehicleDetailView) { + VehicleDetailView(selectedVehicle: $selectedVehicle, viewModel: viewModel) + } .sheet(isPresented: $isShowingEditVehicleView) { EditVehicleView(selectedVehicle: $selectedVehicle, viewModel: viewModel) } diff --git a/Basic-Car-Maintenance/Shared/Settings/Views/VehicleDetailView.swift b/Basic-Car-Maintenance/Shared/Settings/Views/VehicleDetailView.swift new file mode 100644 index 00000000..a0cc1f7c --- /dev/null +++ b/Basic-Car-Maintenance/Shared/Settings/Views/VehicleDetailView.swift @@ -0,0 +1,121 @@ +// +// VehicleDetailView.swift +// Basic-Car-Maintenance +// +// https://github.com/mikaelacaron/Basic-Car-Maintenance +// See LICENSE for license information. +// + +import SwiftUI + +struct VehicleDetailView: View { + + @Binding var selectedVehicle: Vehicle? + var viewModel: SettingsViewModel + + @State private var name = "" + @State private var make = "" + @State private var model = "" + @State private var year = "" + @State private var color = "" + @State private var VIN = "" + @State private var licensePlateNumber = "" + + @State private var isShowingEditVehicleView = false + + var body: some View { + NavigationStack { + Form { + Section { + Text(name) + } header: { + Text("Name") + } + + Section { + Text(make) + } header: { + Text("Make") + } + + Section { + Text(model) + } header: { + Text("Model") + } + + Section { + Text(year) + } header: { + Text("Year") + } + + Section { + Text(color) + } header: { + Text("Color") + } + + Section { + Text(VIN) + } header: { + Text("VIN") + } + + Section { + Text(licensePlateNumber) + } header: { + Text("License Plate Number") + } + } + .analyticsView("\(Self.self)") + .onAppear { + guard let selectedVehicle else { return } + setVehicleValues(selectedVehicle) + } + .toolbar { + ToolbarItem { + Button { + isShowingEditVehicleView.toggle() + } label: { + Text("Edit") + } + } + } + .navigationTitle(Text("Vehicle Details", comment: "Label about vehicle details.")) + .sheet(isPresented: $isShowingEditVehicleView) { + EditVehicleView( + selectedVehicle: $selectedVehicle, + viewModel: viewModel, + onVehicleUpdated: setVehicleValues + ) + } + } + } + + private func setVehicleValues(_ vehicle: Vehicle) { + self.name = vehicle.name + self.make = vehicle.make + self.model = vehicle.model + self.year = vehicle.year ?? "" + self.color = vehicle.color ?? "" + self.VIN = vehicle.vin ?? "" + self.licensePlateNumber = vehicle.licensePlateNumber ?? "" + } +} + +#Preview { + @Previewable @State var selectedVehicle: Vehicle? = Vehicle( + id: UUID().uuidString, + name: "My Car", + make: "Ford", + model: "F-150", + year: "2020", + color: "Red", + vin: "5YJSA1E26JF123456", + licensePlateNumber: "ABC123" + ) + var viewModel = SettingsViewModel(authenticationViewModel: AuthenticationViewModel()) + + VehicleDetailView(selectedVehicle: $selectedVehicle, viewModel: viewModel) +} From d0ba87f43b73fd52114f6c2cebda72e85763e75b Mon Sep 17 00:00:00 2001 From: Mikaela Caron Date: Mon, 28 Oct 2024 11:12:03 -0400 Subject: [PATCH 2/4] Fix pbxproj file --- Basic-Car-Maintenance.xcodeproj/project.pbxproj | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/Basic-Car-Maintenance.xcodeproj/project.pbxproj b/Basic-Car-Maintenance.xcodeproj/project.pbxproj index d975413b..664927af 100644 --- a/Basic-Car-Maintenance.xcodeproj/project.pbxproj +++ b/Basic-Car-Maintenance.xcodeproj/project.pbxproj @@ -76,6 +76,7 @@ FF52DEBC2CADE9EF0023F8DE /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { isa = PBXFileSystemSynchronizedBuildFileExceptionSet; membershipExceptions = ( + Shared/Info.plist, Shared/PrivacyInfo.xcprivacy, ); target = FF5D13A22A86C2D600BC9BD6 /* Basic-Car-Maintenance */; @@ -583,7 +584,6 @@ CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Basic-Car-Maintenance/Preview Content\""; - DEVELOPMENT_TEAM = FG6TDFAG29; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -604,7 +604,6 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = "-ObjC"; - PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -626,7 +625,6 @@ CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Basic-Car-Maintenance/Preview Content\""; - DEVELOPMENT_TEAM = FG6TDFAG29; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -647,7 +645,6 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = "-ObjC"; - PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -665,11 +662,9 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = FG6TDFAG29; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.0; MACOSX_DEPLOYMENT_TARGET = 15.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -688,11 +683,9 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = FG6TDFAG29; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.0; MACOSX_DEPLOYMENT_TARGET = 15.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.Tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -710,11 +703,9 @@ buildSettings = { CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = FG6TDFAG29; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.0; MACOSX_DEPLOYMENT_TARGET = 15.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.UITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -732,11 +723,9 @@ buildSettings = { CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = FG6TDFAG29; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.0; MACOSX_DEPLOYMENT_TARGET = 15.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.UITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; @@ -755,7 +744,6 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = FG6TDFAG29; ENABLE_USER_SCRIPT_SANDBOXING = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Basic-Car-Maintenance-Widget/Info.plist"; @@ -767,7 +755,6 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.Widget"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -785,7 +772,6 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = FG6TDFAG29; ENABLE_USER_SCRIPT_SANDBOXING = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Basic-Car-Maintenance-Widget/Info.plist"; @@ -797,7 +783,6 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.rhinebird.Basic-Car-Maintenance.Widget"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; From 5758559916d2ba8c5554193afacbb59fe077fe7a Mon Sep 17 00:00:00 2001 From: Mikaela Caron Date: Mon, 28 Oct 2024 11:59:39 -0400 Subject: [PATCH 3/4] Put the Vehicle details into a Button --- .../Shared/Settings/Views/SettingsView.swift | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift b/Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift index d614834a..2dc1db0c 100644 --- a/Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift +++ b/Basic-Car-Maintenance/Shared/Settings/Views/SettingsView.swift @@ -92,45 +92,45 @@ struct SettingsView: View { Section { ForEach(viewModel.vehicles) { vehicle in - VStack(alignment: .leading, spacing: 2) { - Text("\(vehicle.name)") - .fontWeight(.bold) - .font(.headline) - - Group { - HStack { - if let year = vehicle.year, !year.isEmpty { - Text(year) + Button { + selectedVehicle = vehicle + isShowingVehicleDetailView = true + } label: { + VStack(alignment: .leading, spacing: 2) { + Text("\(vehicle.name)") + .fontWeight(.bold) + .font(.headline) + + Group { + HStack { + if let year = vehicle.year, !year.isEmpty { + Text(year) + } + + Text(vehicle.make) + + Text(vehicle.model) } - Text(vehicle.make) + if let licensePlateNumber = + vehicle.licensePlateNumber, + !licensePlateNumber.isEmpty { + Text("Plate: \(licensePlateNumber)") + } - Text(vehicle.model) - } - - if let licensePlateNumber = - vehicle.licensePlateNumber, - !licensePlateNumber.isEmpty { - Text("Plate: \(licensePlateNumber)") - } - - if let vin = vehicle.vin, !vin.isEmpty { - Text("VIN: \(vin)") + if let vin = vehicle.vin, !vin.isEmpty { + Text("VIN: \(vin)") + } + + if let color = vehicle.color, !color.isEmpty { + Text("Color: \(color)") + } } - - if let color = vehicle.color, !color.isEmpty { - Text("Color: \(color)") - } + .font(.callout) + .foregroundStyle(.secondary) } - .font(.callout) - .foregroundStyle(.secondary) - } - .frame(maxWidth: .infinity, alignment: .leading) - .contentShape(Rectangle()) - .onTapGesture { - selectedVehicle = vehicle - isShowingVehicleDetailView = true } + .buttonStyle(.plain) .swipeActions { Button(role: .destructive) { Task { From b04a47efa1998366d6903e61f98d39385c8d0a52 Mon Sep 17 00:00:00 2001 From: Mikaela Caron Date: Mon, 28 Oct 2024 12:03:17 -0400 Subject: [PATCH 4/4] Add comment --- .../Shared/Settings/Views/EditVehicleView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift b/Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift index b12757aa..77b9d77b 100644 --- a/Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift +++ b/Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift @@ -11,6 +11,8 @@ import SwiftUI struct EditVehicleView: View, Observable { @Binding var selectedVehicle: Vehicle? var viewModel: SettingsViewModel + + /// closure to update the values passed in, and set them to all the state properties var onVehicleUpdated: ((Vehicle) -> Void)? @Environment(\.dismiss) var dismiss