- July 26, 2025
- Mins Read
Experimenting with SwiftUI
whilst creating a practical app to craft that perfect button style.
https://testflight.apple.com/join/pZDhygQt
Last TestFlight bump: 13th November 2024
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()
ColorPicker
This is posted as a way to share SwiftUI learnings (and is not production level code). Use it at your own risk.
NavigationKit is a lightweight library which makes SwiftUI navigation super easy to use. 💻 Installation 📦 Swift Package Manager Using Swift Package Manager, add ...
An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations and programmatic navigation. NavigationStack Installation ...
With SwiftUI Router you can power your SwiftUI app with path-based routing. By utilizing a path-based system, navigation in your app becomes ...
This package takes SwiftUI's familiar and powerful NavigationStack API and gives it superpowers, allowing you to use the same API not just ...