Last active
May 27, 2020 03:12
-
-
Save azamsharp/a8fb75f5fa2c6b326eea22f933b72bee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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