Added swipe actions to all the dummy items in the BrowseView view.
This commit is contained in:
parent
7c5aed8b8c
commit
c9b148a2ff
@ -11,6 +11,7 @@ import SwiftUI
|
||||
struct BrowseView: View {
|
||||
var body: some View {
|
||||
List {
|
||||
Group {
|
||||
Group {
|
||||
FolderItem(name: "Some folder #1 name")
|
||||
FolderItem(name: "Some folder #2 name")
|
||||
@ -58,6 +59,34 @@ struct BrowseView: View {
|
||||
)
|
||||
}
|
||||
}
|
||||
.swipeActions(
|
||||
edge: .trailing,
|
||||
allowsFullSwipe: true
|
||||
) {
|
||||
Button {
|
||||
// ...
|
||||
} label: {
|
||||
Label {
|
||||
Text("Delete item")
|
||||
} icon: {
|
||||
Image.trash
|
||||
}
|
||||
}
|
||||
.tint(.red)
|
||||
|
||||
// TODO: allow download only if item is a file.
|
||||
Button {
|
||||
// ...
|
||||
} label: {
|
||||
Label {
|
||||
Text("Download item")
|
||||
} icon: {
|
||||
Image.download
|
||||
}
|
||||
}
|
||||
.tint(.orange)
|
||||
}
|
||||
}
|
||||
.listStyle(.inset)
|
||||
.background(Color.red)
|
||||
.navigationTitle("Folder name")
|
||||
@ -78,6 +107,8 @@ struct BrowseView: View {
|
||||
|
||||
private extension Image {
|
||||
static let profile = Image(systemName: "person.crop.circle.fill")
|
||||
static let trash = Image(systemName: "trash")
|
||||
static let download = Image(systemName: "arrow.down.doc")
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
Loading…
x
Reference in New Issue
Block a user