Button Styles in SwiftUI

This is a table explaining the different button styles in SwiftUI and which platform each Button Style is available on.

Button StyleiOSwatchOSiPad OSmacOS

| PlainButtonStyle | ✅ | ✅ | ✅ | ✅ | | | | | | | | LinkButtonStyle | ❌ | ❌ | ❌ | ✅ | | | | | | | | BorderedButtonStyle | ❌ | ❌ | ❌ | ✅ | | | | | | | | BorderlessButtonStyle | ✅ | ❌ | ✅ | ✅ | | | | | | |

How to use

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.


If you enjoy my posts, please consider sharing it or Buying me a Coffee!

Buy Me A Coffee

This post is also available on DEV.