Skip to content

Instantly share code, notes, and snippets.

@DominatorVbN
Created July 7, 2020 16:01
Show Gist options
  • Save DominatorVbN/9988d3ba94dc0377ff67f722f5268241 to your computer and use it in GitHub Desktop.
Save DominatorVbN/9988d3ba94dc0377ff67f722f5268241 to your computer and use it in GitHub Desktop.
New group box view in SwiftUI
import SwiftUI
struct GroupBoxs: View {
@State var progress: CGFloat = 0.3
var body: some View {
VStack(spacing: 20) {
//Groupbox arranges view as an vstack so it's safe to assume that has an implicit VStack in defination
GroupBox(label: Text("Progress"), content: {
ProgressView(value: progress, total: 1.0)
Stepper("Progress stepper", value: $progress)
})
//Group box can have label optionally
GroupBox {
Slider(value: $progress)
}
}
.padding(.all, 20)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment