deleting tendies from list

This commit is contained in:
leminlimez committed 2025-06-01 06:47:21 -04:00
1 parent 3d2cd8d522
commit 67c3fdb36a
1 file changed
+12 -6
+12 -6
View File
@@ -47,15 +47,15 @@ struct ContentView: View {
if let selectedTendies = selectedTendies { if let selectedTendies = selectedTendies {
HStack { HStack {
Text("Selected Tendies:") Text("Selected Tendies")
.bold() .font(.headline)
Spacer() Spacer()
} }
ForEach(selectedTendies, id: \.self) { tendie in List {
HStack { ForEach(selectedTendies, id: \.self) { tendie in
Text("- \(tendie.deletingPathExtension().lastPathComponent)") Text(tendie.deletingPathExtension().lastPathComponent)
Spacer()
} }
.onDelete(perform: delete)
} }
} }
} }
@@ -130,6 +130,12 @@ struct ContentView: View {
}) })
} }
func delete(at offsets: IndexSet) {
if selectedTendies != nil {
selectedTendies?.remove(atOffsets: offsets)
}
}
init() { init() {
// Fix file picker // Fix file picker
let fixMethod = class_getInstanceMethod(UIDocumentPickerViewController.self, #selector(UIDocumentPickerViewController.fix_init(forOpeningContentTypes:asCopy:)))! let fixMethod = class_getInstanceMethod(UIDocumentPickerViewController.self, #selector(UIDocumentPickerViewController.fix_init(forOpeningContentTypes:asCopy:)))!