Skip to content

Instantly share code, notes, and snippets.

@rr-codes
Last active July 17, 2020 01:37
Show Gist options
  • Select an option

  • Save rr-codes/4e5e722a81a3ea86afd3cfdc420da74d to your computer and use it in GitHub Desktop.

Select an option

Save rr-codes/4e5e722a81a3ea86afd3cfdc420da74d to your computer and use it in GitHub Desktop.
/// An implementation of `ProgressView` built in SwiftUI
struct ProgressViewSUI<Progress>: View where Progress: BinaryFloatingPoint {
var value: Progress
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .leading) {
Capsule()
.foregroundColor(.gray)
.opacity(0.3)
Capsule()
.foregroundColor(.white)
.frame(width: geometry.size.width * CGFloat(value))
}
}
.frame(height: 4)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment