Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heyjaywilson/swiftui-buttons
https://github.com/heyjaywilson/swiftui-buttons
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/heyjaywilson/swiftui-buttons
- Owner: heyjaywilson
- Created: 2019-10-15T12:01:25.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-15T18:18:12.000Z (7 months ago)
- Last Synced: 2024-05-02T01:05:38.094Z (7 months ago)
- Language: Swift
- Size: 174 KB
- Stars: 8
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Button Styles
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` | ✅ | ✅ | ✅ | ✅ |
| | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/macos-ios-plain.png?raw=true) | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/watchos_plain.png?raw=true) | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/macos-ios-plain.png?raw=true) | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/macos-ios-plain.png?raw=true) |
| `LinkButtonStyle`| ❌ | ❌ | ❌ | ✅ |
| | | | | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/macos_link.png?raw=true) |
| `BorderedButtonStyle`| ❌ | ❌ | ❌ | ✅ |
| | | | | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/macos_bordered.png?raw=true) |
| `BorderlessButtonStyle` | ✅ | ❌ | ✅ | ✅ |
| | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/iOS-borderless.png?raw=true) | | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/iOS-borderless.png?raw=true) | ![](https://github.com/maeganjwilson/swiftui-buttons/blob/master/images/macos_borderless.png?raw=true) |# How to use
Here is sample code of how to use a Button Style in SwiftUI.
```swift
Button(action: {
print("plain")
}) {
Text("Borderless button")
}.buttonStyle(BorderlessButtonStyle())```
In the [GitHub repo](https://github.com/heyjaywilson/swiftui-buttons), there is an Xcode project with each button style used.