From 5c4dbce95e125ea2655760508d8bd4d7b9951b7a Mon Sep 17 00:00:00 2001 From: Kameron Kenny Date: Wed, 19 Mar 2025 12:43:15 -0400 Subject: [PATCH] organize --- Gas Man.xcodeproj/project.pbxproj | 4 +- Gas Man/ContentView.swift | 88 ------------------- Gas Man/{ => FuelLogs}/AddFuelLogView.swift | 0 Gas Man/{ => FuelLogs}/EditFuelLogView.swift | 0 .../{ => FuelLogs}/FuelLogDetailView.swift | 0 Gas Man/{ => FuelLogs}/FuelLogListView.swift | 0 .../{ => FuelLogs}/FuelLogSummaryView.swift | 0 .../AddMaintenanceView.swift | 0 .../MaintenanceListView.swift | 0 Gas Man/{ => Vehicle}/AddVehicleView.swift | 0 Gas Man/{ => Vehicle}/EditVehicleView.swift | 0 Gas Man/{ => Vehicle}/Vehicle.swift | 0 Gas Man/{ => Vehicle}/VehicleDetailView.swift | 0 Gas Man/{ => Vehicle}/VehicleRowView.swift | 0 Gas Man/VehicleListView.swift | 59 ------------- 15 files changed, 2 insertions(+), 149 deletions(-) delete mode 100644 Gas Man/ContentView.swift rename Gas Man/{ => FuelLogs}/AddFuelLogView.swift (100%) rename Gas Man/{ => FuelLogs}/EditFuelLogView.swift (100%) rename Gas Man/{ => FuelLogs}/FuelLogDetailView.swift (100%) rename Gas Man/{ => FuelLogs}/FuelLogListView.swift (100%) rename Gas Man/{ => FuelLogs}/FuelLogSummaryView.swift (100%) rename Gas Man/{ => Maintenance}/AddMaintenanceView.swift (100%) rename Gas Man/{ => Maintenance}/MaintenanceListView.swift (100%) rename Gas Man/{ => Vehicle}/AddVehicleView.swift (100%) rename Gas Man/{ => Vehicle}/EditVehicleView.swift (100%) rename Gas Man/{ => Vehicle}/Vehicle.swift (100%) rename Gas Man/{ => Vehicle}/VehicleDetailView.swift (100%) rename Gas Man/{ => Vehicle}/VehicleRowView.swift (100%) delete mode 100644 Gas Man/VehicleListView.swift diff --git a/Gas Man.xcodeproj/project.pbxproj b/Gas Man.xcodeproj/project.pbxproj index bfebcf2..d167c41 100644 --- a/Gas Man.xcodeproj/project.pbxproj +++ b/Gas Man.xcodeproj/project.pbxproj @@ -289,7 +289,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "Gas Man/Gas_Man.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 202503191221; + CURRENT_PROJECT_VERSION = 202503191240; DEVELOPMENT_ASSET_PATHS = "\"Gas Man/Preview Content\""; DEVELOPMENT_TEAM = Z734T5CD6B; ENABLE_HARDENED_RUNTIME = YES; @@ -332,7 +332,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "Gas Man/Gas_Man.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 202503191221; + CURRENT_PROJECT_VERSION = 202503191240; DEVELOPMENT_ASSET_PATHS = "\"Gas Man/Preview Content\""; DEVELOPMENT_TEAM = Z734T5CD6B; ENABLE_HARDENED_RUNTIME = YES; diff --git a/Gas Man/ContentView.swift b/Gas Man/ContentView.swift deleted file mode 100644 index e9f3237..0000000 --- a/Gas Man/ContentView.swift +++ /dev/null @@ -1,88 +0,0 @@ -// -// ContentView.swift -// Gas Man -// -// Created by Kameron Kenny on 3/17/25. -// - -import SwiftUI -//import CoreData -// -//struct ContentView: View { -// @Environment(\.managedObjectContext) private var viewContext -// -// @FetchRequest( -// sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)], -// animation: .default) -// private var items: FetchedResults -// -// var body: some View { -// NavigationView { -// List { -// ForEach(items) { item in -// NavigationLink { -// Text("Item at \(item.timestamp!, formatter: itemFormatter)") -// } label: { -// Text(item.timestamp!, formatter: itemFormatter) -// } -// } -// .onDelete(perform: deleteItems) -// } -// .toolbar { -//#if os(iOS) -// ToolbarItem(placement: .navigationBarTrailing) { -// EditButton() -// } -//#endif -// ToolbarItem { -// Button(action: addItem) { -// Label("Add Item", systemImage: "plus") -// } -// } -// } -// Text("Select an item") -// } -// } -// -// private func addItem() { -// withAnimation { -// let newItem = Item(context: viewContext) -// newItem.timestamp = Date() -// -// do { -// try viewContext.save() -// } catch { -// // Replace this implementation with code to handle the error appropriately. -// // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. -// let nsError = error as NSError -// fatalError("Unresolved error \(nsError), \(nsError.userInfo)") -// } -// } -// } -// -// private func deleteItems(offsets: IndexSet) { -// withAnimation { -// offsets.map { items[$0] }.forEach(viewContext.delete) -// -// do { -// try viewContext.save() -// } catch { -// // Replace this implementation with code to handle the error appropriately. -// // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. -// let nsError = error as NSError -// fatalError("Unresolved error \(nsError), \(nsError.userInfo)") -// } -// } -// } -//} -// -//private let itemFormatter: DateFormatter = { -// let formatter = DateFormatter() -// formatter.dateStyle = .short -// formatter.timeStyle = .medium -// return formatter -//}() - -//#Preview { -// ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) -//} diff --git a/Gas Man/AddFuelLogView.swift b/Gas Man/FuelLogs/AddFuelLogView.swift similarity index 100% rename from Gas Man/AddFuelLogView.swift rename to Gas Man/FuelLogs/AddFuelLogView.swift diff --git a/Gas Man/EditFuelLogView.swift b/Gas Man/FuelLogs/EditFuelLogView.swift similarity index 100% rename from Gas Man/EditFuelLogView.swift rename to Gas Man/FuelLogs/EditFuelLogView.swift diff --git a/Gas Man/FuelLogDetailView.swift b/Gas Man/FuelLogs/FuelLogDetailView.swift similarity index 100% rename from Gas Man/FuelLogDetailView.swift rename to Gas Man/FuelLogs/FuelLogDetailView.swift diff --git a/Gas Man/FuelLogListView.swift b/Gas Man/FuelLogs/FuelLogListView.swift similarity index 100% rename from Gas Man/FuelLogListView.swift rename to Gas Man/FuelLogs/FuelLogListView.swift diff --git a/Gas Man/FuelLogSummaryView.swift b/Gas Man/FuelLogs/FuelLogSummaryView.swift similarity index 100% rename from Gas Man/FuelLogSummaryView.swift rename to Gas Man/FuelLogs/FuelLogSummaryView.swift diff --git a/Gas Man/AddMaintenanceView.swift b/Gas Man/Maintenance/AddMaintenanceView.swift similarity index 100% rename from Gas Man/AddMaintenanceView.swift rename to Gas Man/Maintenance/AddMaintenanceView.swift diff --git a/Gas Man/MaintenanceListView.swift b/Gas Man/Maintenance/MaintenanceListView.swift similarity index 100% rename from Gas Man/MaintenanceListView.swift rename to Gas Man/Maintenance/MaintenanceListView.swift diff --git a/Gas Man/AddVehicleView.swift b/Gas Man/Vehicle/AddVehicleView.swift similarity index 100% rename from Gas Man/AddVehicleView.swift rename to Gas Man/Vehicle/AddVehicleView.swift diff --git a/Gas Man/EditVehicleView.swift b/Gas Man/Vehicle/EditVehicleView.swift similarity index 100% rename from Gas Man/EditVehicleView.swift rename to Gas Man/Vehicle/EditVehicleView.swift diff --git a/Gas Man/Vehicle.swift b/Gas Man/Vehicle/Vehicle.swift similarity index 100% rename from Gas Man/Vehicle.swift rename to Gas Man/Vehicle/Vehicle.swift diff --git a/Gas Man/VehicleDetailView.swift b/Gas Man/Vehicle/VehicleDetailView.swift similarity index 100% rename from Gas Man/VehicleDetailView.swift rename to Gas Man/Vehicle/VehicleDetailView.swift diff --git a/Gas Man/VehicleRowView.swift b/Gas Man/Vehicle/VehicleRowView.swift similarity index 100% rename from Gas Man/VehicleRowView.swift rename to Gas Man/Vehicle/VehicleRowView.swift diff --git a/Gas Man/VehicleListView.swift b/Gas Man/VehicleListView.swift deleted file mode 100644 index 3814c8a..0000000 --- a/Gas Man/VehicleListView.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// VehicleListView.swift -// Gas Man -// -// Created by Kameron Kenny on 3/18/25. -// - - -import SwiftUI -import CoreData - -struct VehicleListView: View { - @Environment(\.managedObjectContext) private var viewContext - @FetchRequest( - sortDescriptors: [NSSortDescriptor(keyPath: \Vehicle.make, ascending: true)], - animation: .default) - private var vehicles: FetchedResults - - @State private var showingAddVehicle = false - - var body: some View { - NavigationView { - List { - ForEach(vehicles) { vehicle in - NavigationLink(destination: VehicleDetailView(vehicle: vehicle)) { - VehicleRowView(vehicle: vehicle) - } - } - .onDelete(perform: deleteVehicles) - } - .navigationTitle("Vehicles") - .toolbar { - ToolbarItem(placement: .navigationBarTrailing) { - Button(action: { showingAddVehicle = true }) { - Label("Add Vehicle", systemImage: "plus") - } - } - ToolbarItem(placement: .navigationBarLeading) { - EditButton() - } - } - .sheet(isPresented: $showingAddVehicle) { - AddVehicleView().environment(\.managedObjectContext, viewContext) - } - } - } - - private func deleteVehicles(offsets: IndexSet) { - withAnimation { - offsets.map { vehicles[$0] }.forEach(viewContext.delete) - do { - try viewContext.save() - } catch { - let nsError = error as NSError - fatalError("Unresolved error \(nsError), \(nsError.userInfo)") - } - } - } -}