Code: < /p>
Code: Select all
import SwiftUI
import Foundation
struct ContentView: View {
var body: some View {
NavigationStack {
VStack {
List {
Section {
HStack {
Text("Hello World").font(.body)
Spacer()
Divider().frame(width: 3.0)
.overlay(Color.blue).padding(.trailing, -50.0).padding([.top, .bottom], -1.5)
}
.padding([.top, .bottom], 1.5)
.swipeActions(allowsFullSwipe: false) {
Button(role: .destructive) {
print("Deleting row")
} label: {
/// Note: Want to show Image and text below it.
VStack(spacing: 2.0) {
Image(systemName: "trash")
Text("Delete").font(.caption2)
}
/// Note: Using label as well doesn't show both text and icon. It only shows the icon.
// Label("Delete", systemImage: "trash")
}
// TODO: Add more swipe action buttons
}
}
}
.listStyle(.insetGrouped)
}
}
}
}