Created
January 6, 2023 19:09
-
-
Save navsing/9fc6e5cdb0c469fc72ab80236d6f66d3 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
ZStack(alignment: Alignment(horizontal: .leading, vertical: .center), content: { | |
Capsule() | |
.fill(Color.gray.opacity(0.2)) | |
.frame(height: 6) | |
ZStack(alignment: Alignment(horizontal: .trailing, vertical: .center)) { | |
Capsule() | |
.fill(Color("dark").opacity(0.6)) | |
.frame(width: value,height: 6) //value is the current volume percentage | |
Circle() | |
.fill(Color("dark")) | |
.frame(width: 10, height: 10).padding(.all, 10).background(Color("light")).clipShape(Circle()) | |
.shadow(color: Color("dark"), radius: 5, x: -10, y: -10) | |
.blur(radius: 5) | |
} | |
}) | |
.gesture(DragGesture().onChanged({ (value) in | |
if value.location.x <= UIScreen.main.bounds.width - 30 && value.location.x >= 0{ | |
self.value = value.location.x | |
} | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment