This is a table explaining the different button styles in SwiftUI and which platform each Button Style is available on.
Button Style | iOS | watchOS | iPad OS | macOS |
---|---|---|---|---|
PlainButtonStyle |
✅ | ✅ | ✅ | ✅ |
LinkButtonStyle |
❌ | ❌ | ❌ | ✅ |
BorderedButtonStyle |
❌ | ❌ | ❌ | ✅ |
BorderlessButtonStyle |
✅ | ❌ | ✅ | ✅ |
Here is sample code of how to use a Button Style in SwiftUI.
Button(action: {
print("plain")
}) {
Text("Borderless button")
}.buttonStyle(BorderlessButtonStyle())
In the GitHub repo, there is an Xcode project with each button style used.