Has anyone tried doing macOS dev with SwiftUI?
In particular, tried using the swipeActions
functionality with a List
on macOS?
I can't get it to work in my own project, or in a smaller example.
Here is a short example from Paul Hudson:
Here is the code – sorry, it seems you cannot link to Paul's site in these forums:
struct ContentView: View {
var body: some View {
List {
Text("Pepperoni pizza")
.swipeActions {
Button("Order") {
print("Awesome!")
}
.tint(.green)
}
Text("Pepperoni with pineapple")
.swipeActions {
Button("Burn") {
print("Right on!")
}
.tint(.red)
}
}
}
}
Works great in iOS 15 beta running in the Simulator. Exactly as you'd expect.
Doesn’t work at all on macOS Monterey beta when dropped into a project targeting macOS 12.0.
Is there something else one needs to do to manipulate list items using a swipe action on macOS?
The documentation states this is supported on macOS 12.0+.
Any thoughts or suggestions would be much appreciated.