Last active
August 21, 2022 10:35
-
-
Save lutes1/178957f2c4189f430c3c0db4ae81ece2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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