Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created May 30, 2022 21:51
Show Gist options
  • Save sturdysturge/4a0427f92c95b791429f1f5df9c447b8 to your computer and use it in GitHub Desktop.
Save sturdysturge/4a0427f92c95b791429f1f5df9c447b8 to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@State var width = CGFloat(100)
@State var height = CGFloat(100)
var body: some View {
VStack {
Spacer()
Group {
HStack {
Text("Width")
Slider(value: $width, in: 100...1000)
Text(String(format: "%.2f", width))
}
HStack {
Text("Height")
Slider(value: $height, in: 100...1000)
Text(String(format: "%.2f", height))
}
}
.padding()
.background(Color.white)
}
.background(
ScaledPaddingView()
.frame(width: width, height: height)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment