Skip to content

Instantly share code, notes, and snippets.

@filimo
Created March 7, 2020 21:02
Show Gist options
  • Save filimo/393c544de1169c9c41d2d78ed775ae3c to your computer and use it in GitHub Desktop.
Save filimo/393c544de1169c9c41d2d78ed775ae3c to your computer and use it in GitHub Desktop.
extension Color {
static let offWhite = Color(red: 225 / 255, green: 225 / 255, blue: 235 / 255)
}
struct SimpleButtonStyle: ButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
.padding(30)
.background(
RoundedRectangle(cornerRadius: 20)
.fill(Color.offWhite)
.shadow(color: Color.black.opacity(0.2), radius: 10, x: 10, y: 10)
.shadow(color: Color.white.opacity(0.7), radius: 10, x: -5, y: -5)
)
}
}
struct Neomorphic2Demo: View {
var body: some View {
ZStack {
Color.offWhite
Button(action: {
print("Button tapped")
}) {
Text("Tap")
.foregroundColor(.gray)
}
.buttonStyle(SimpleButtonStyle())
}
.edgesIgnoringSafeArea(.all)
}
}
@filimo
Copy link
Author

filimo commented Mar 7, 2020

Screen Shot 2020-03-08 at 00 02 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment