Skip to content

Instantly share code, notes, and snippets.

@lutes1
Last active August 21, 2022 10:35
Show Gist options
  • Save lutes1/178957f2c4189f430c3c0db4ae81ece2 to your computer and use it in GitHub Desktop.
Save lutes1/178957f2c4189f430c3c0db4ae81ece2 to your computer and use it in GitHub Desktop.
struct HeaderView: View {
var viewModel: HeaderViewModel
var body: some View {
ZStack {
HStack {
if let leftButtonTitle = viewModel.leftButtonTitle {
Button(leftButtonTitle) {
viewModel.leftButtonAction?()
}
}
if let sizeBinding = viewModel.sizeControlCallback {
Stepper("", value: sizeBinding , in: 0...4)
.frame(width: 100)
}
Spacer()
if let colorIndicator = viewModel.colorIndicator {
ColorItemView(color: Color(colorIndicator))
}
if let sizeIndicator = viewModel.sizeIndicator {
Text(sizeIndicator)
.font(.title.bold())
}
if let tiltIndicator = viewModel.tiltIndicator {
Text("\(tiltIndicator)°")
.font(.title.bold())
}
}
Text(viewModel.title)
.font(.title.bold())
}
.buttonStyle(.bordered)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment