0

I have a list to which I need to attach a swipe action:

struct TestListView: View {
    var items = ["A", "B", "C"]
        
    var body: some View {
        List() {
            ForEach(0 ..< items.count, id: \.self) { idx in
                let item = items[idx]
                Text("\(item)")
            }
            .swipeActions {
                Button("Person") {
                   // Do Something
                }
                .tint(.red)
            }
        }
    }
}

Unfortunately, the text doesn't appear on watchOS:

enter image description here

Exactly the same code works on iOS:

enter image description here

What am I doing wrong?

Fab
  • 1,468
  • 1
  • 16
  • 37

1 Answers1

0

WatchOS seems to only allow images on these button, probably due to screen size. Try using Label instead of Text, with both an icon and title, and you should automatically get the correct behavior on both iOS and watchOS.

Adam
  • 4,405
  • 16
  • 23