Skip to content

Instantly share code, notes, and snippets.

@chriseidhof
Created March 28, 2024 13:53
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 chriseidhof/50418cae1e4472a7a99e828c0587e03a to your computer and use it in GitHub Desktop.
Save chriseidhof/50418cae1e4472a7a99e828c0587e03a to your computer and use it in GitHub Desktop.
//
import SwiftUI
struct ContentView: View {
@State var progress: Double = 0
var body: some View {
VStack {
Slider(value: $progress, in: 0...1)
Text("Hello, world")
.foregroundStyle(.white)
.padding()
.frame(maxWidth: .infinity)
.background(Color.black)
.overlay {
GeometryReader { proxy in
Color.green
.overlay {
Text("Hello, world")
.foregroundStyle(.black)
}
.frame(width: proxy.size.width)
.frame(width: proxy.size.width*progress, alignment: .leading)
.clipped()
}
}
}
}
}
#Preview {
ContentView()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment