Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created November 4, 2020 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/3e9538ed83acf1521bc8c234ef3f7b83 to your computer and use it in GitHub Desktop.
Save laevandus/3e9538ed83acf1521bc8c234ef3f7b83 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@StateObject var viewModel = ViewModel(package: .makeExample())
var body: some View {
ScrollView {
VStack(spacing: 16) {
Text("Recipient")
.font(.headline)
InputView(title: "First name",
value: $viewModel.recipientFirstName)
InputView(title: "Last name",
value: $viewModel.recipientLastName)
Text("Address")
.font(.headline)
InputView(title: "Street",
placeholder: "e.g. 37 Christie St",
value: viewModel.street)
Text("Summary")
.font(.headline)
Text(viewModel.summary)
.frame(maxWidth: .infinity, alignment: .leading)
Button("Add item", action: viewModel.addRandomItem)
}
.padding()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment