Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atrinh0/buttoncraft
Craft that perfect SwiftUI button effect 👌🏼
https://github.com/atrinh0/buttoncraft
button-animation buttons ios ios14 swiftui
Last synced: 5 days ago
JSON representation
Craft that perfect SwiftUI button effect 👌🏼
- Host: GitHub
- URL: https://github.com/atrinh0/buttoncraft
- Owner: atrinh0
- License: mit
- Created: 2020-08-02T14:13:06.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-13T11:00:48.000Z (30 days ago)
- Last Synced: 2024-12-01T01:03:25.534Z (12 days ago)
- Topics: button-animation, buttons, ios, ios14, swiftui
- Language: Swift
- Homepage:
- Size: 16.8 MB
- Stars: 432
- Watchers: 8
- Forks: 16
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- fucking-open-source-ios-apps - buttoncraft
- awesome-cocoa - buttoncraft
- awesome-swiftui-libraries - buttoncraft - Craft that perfect SwiftUI button effect (Button / Content)
README
# buttoncraft (SwiftUI App)
> Experimenting with `SwiftUI` whilst creating a practical app to craft that perfect button style.### ✈️ Testflight
https://testflight.apple.com/join/pZDhygQt
> Last TestFlight bump: 13th November 2024
### 👨🏻💻 Code outputted from app
```Swift
struct MyButtonStyle: ButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
.background(Capsule()
.foregroundColor(configuration.isPressed ? Color.primary.opacity(0.75) : Color.primary))
.scaleEffect(configuration.isPressed ? CGFloat(0.85) : 1.0)
.rotationEffect(.degrees(configuration.isPressed ? 0.0 : 0))
.blur(radius: configuration.isPressed ? CGFloat(0.0) : 0)
.animation(Animation.spring(response: 0.35, dampingFraction: 0.35, blendDuration: 1), value: configuration.isPressed)
}
}extension Button {
func myButtonStyle() -> some View {
self.buttonStyle(MyButtonStyle())
}
}// to use
Button { } label: {
Text("just like that")
.font(Font.body.bold())
.padding()
.foregroundColor(Color.primary)
.colorInvert()
}
.myButtonStyle()Button { } label: {
Image(systemName: "face.smiling")
.font(Font.body.bold())
.imageScale(.large)
.padding()
.foregroundColor(Color.primary)
.colorInvert()
}
.myButtonStyle()```
### 🧐 Features
- 🔀 Randomise different settings for inspiration
- Reset to my default style
- Using the new iOS `ColorPicker`
- Copy your perfect masterpiece as a code snippet to your clipboard### 👨🏻⚖️ Disclaimer
> This is posted as a way to share SwiftUI learnings (and is not production level code). Use it at your own risk.