deleting tendies from list
This commit is contained in:
1 parent
3d2cd8d522
commit
67c3fdb36a
1 file changed
+12
-6
@@ -47,15 +47,15 @@ struct ContentView: View {
|
||||
|
||||
if let selectedTendies = selectedTendies {
|
||||
HStack {
|
||||
Text("Selected Tendies:")
|
||||
.bold()
|
||||
Text("Selected Tendies")
|
||||
.font(.headline)
|
||||
Spacer()
|
||||
}
|
||||
ForEach(selectedTendies, id: \.self) { tendie in
|
||||
HStack {
|
||||
Text("- \(tendie.deletingPathExtension().lastPathComponent)")
|
||||
Spacer()
|
||||
List {
|
||||
ForEach(selectedTendies, id: \.self) { tendie in
|
||||
Text(tendie.deletingPathExtension().lastPathComponent)
|
||||
}
|
||||
.onDelete(perform: delete)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,12 @@ struct ContentView: View {
|
||||
})
|
||||
}
|
||||
|
||||
func delete(at offsets: IndexSet) {
|
||||
if selectedTendies != nil {
|
||||
selectedTendies?.remove(atOffsets: offsets)
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
// Fix file picker
|
||||
let fixMethod = class_getInstanceMethod(UIDocumentPickerViewController.self, #selector(UIDocumentPickerViewController.fix_init(forOpeningContentTypes:asCopy:)))!
|
||||
|
||||
Reference in new issue
Block a user