diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-07-27 22:32:10 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-07-27 22:32:10 +0200 |
| commit | a4e804275517af683afa1733e2db7c383c306f2b (patch) | |
| tree | 643eff7b3648aad15ce569eec0e1d7c9abddc00d /Captura/PreferencesWindow.swift | |
| parent | e834022c9b363804d36045892a305204f2019216 (diff) | |
Use framerate, control stop
Diffstat (limited to 'Captura/PreferencesWindow.swift')
| -rw-r--r-- | Captura/PreferencesWindow.swift | 50 |
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) -} |