Hi,
I have the below code and don't know why the text doesn't show fro swipe buttons just the icons show ?
Kind Regards
import SwiftUI
struct NewView: View {
var body: some View {
NavigationStack {
List {
ForEach(1...7, id: \.self) { number in
VStack {
Text("Item \(number)")
.padding()
}
.swipeActions(edge: .trailing) {
Button(role: .destructive) {
withAnimation {
deletePatient2()
}
} label: {
Label("Delete", systemImage: "trash.fill")
}
Button {
deletePatient2()
// toDoToEdit = item
} label: {
Label("Edit", systemImage: "pencil")
}
.tint(.orange)
}
}
}
}
.listStyle(.plain)
}
func deletePatient2() {
}
}
#Preview {
NewView()
}
Swipe actions may display the label's text, icon, or both, depending on the height of the row and the platform.
iOS and iPadOS prefer showing the icon instead of the title when the row isn't tall enough to display both.
In your example, if you make the content of the row take up more vertical space, such as by adding more text or increasing the the padding, you'll see that both the text and icon are displayed. (In the video you linked to, the row content is much taller.)