aboutsummaryrefslogtreecommitdiff
path: root/Captura/PreferencesWindow.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Captura/PreferencesWindow.swift')
-rw-r--r--Captura/PreferencesWindow.swift50
1 files changed, 0 insertions, 50 deletions
diff --git a/Captura/PreferencesWindow.swift b/Captura/PreferencesWindow.swift
deleted file mode 100644
index fdb3a6c..0000000
--- a/Captura/PreferencesWindow.swift
+++ /dev/null
@@ -1,50 +0,0 @@
-import SwiftUI
-import SwiftData
-
-struct PreferencesWindow: View {
- @Environment(\.modelContext) private var modelContext
- @Query private var items: [Item]
-
- var body: some View {
- NavigationView {
- List {
- ForEach(items) { item in
- NavigationLink {
- Text("Item at \(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))")
- } label: {
- Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))
- }
- }
- .onDelete(perform: deleteItems)
- }
- .toolbar {
- ToolbarItem {
- Button(action: addItem) {
- Label("Add Item", systemImage: "plus")
- }
- }
- }
- Text("Select an item")
- }
- }
-
- private func addItem() {
- withAnimation {
- let newItem = Item(timestamp: Date())
- modelContext.insert(newItem)
- }
- }
-
- private func deleteItems(offsets: IndexSet) {
- withAnimation {
- for index in offsets {
- modelContext.delete(items[index])
- }
- }
- }
-}
-
-#Preview {
- PreferencesWindow()
- .modelContainer(for: Item.self, inMemory: true)
-}