deleting tendies from list
This commit is contained in:
1 parent
3d2cd8d522
commit
67c3fdb36a
1 file changed
+11
-5
@@ -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()
|
||||||
}
|
}
|
||||||
|
List {
|
||||||
ForEach(selectedTendies, id: \.self) { tendie in
|
ForEach(selectedTendies, id: \.self) { tendie in
|
||||||
HStack {
|
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:)))!
|
||||||
|
|||||||
Reference in new issue
Block a user