Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Last active May 27, 2020 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azamsharp/a8fb75f5fa2c6b326eea22f933b72bee to your computer and use it in GitHub Desktop.
Save azamsharp/a8fb75f5fa2c6b326eea22f933b72bee to your computer and use it in GitHub Desktop.
var body: some View {
Button(action: {
self.isPressed = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
self.isPressed = false
self.onTap()
}
}) {
// SF Symbols
Image(systemName: self.systemName)
.resizable()
.frame(width: self.size.width, height: self.size.height)
.padding(20)
.background(Color(#colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)))
}.clipShape(Circle())
.shadow(color: self.isPressed ? white : gray, radius: self.isPressed ? 4 : 8, x: 8, y: 8)
.shadow(color: self.isPressed ? gray : white, radius: self.isPressed ? 4 : 8, x: -8, y: -8)
.scaleEffect(self.isPressed ? 0.95 : 1.0)
.animation(.spring())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment