mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Add counter example to show viewActions modifying the state.
This commit is contained in:
+8
-2
@@ -38,10 +38,16 @@ struct TemplateUserProfile: View {
|
||||
presence: viewModel.viewState.presence
|
||||
)
|
||||
Divider()
|
||||
VStack{
|
||||
Text("More great user content!")
|
||||
HStack{
|
||||
Text("Counter: \(viewModel.viewState.count)")
|
||||
.font(theme.fonts.title2)
|
||||
.foregroundColor(theme.colors.secondaryContent)
|
||||
Button("-") {
|
||||
viewModel.send(viewAction: .decrementCount)
|
||||
}
|
||||
Button("+") {
|
||||
viewModel.send(viewAction: .incrementCount)
|
||||
}
|
||||
}
|
||||
.frame(maxHeight: .infinity)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user