Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created November 20, 2021 21:47
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/d7c32cf78813ee3c7f076eed1e1d5e96 to your computer and use it in GitHub Desktop.
Save laevandus/d7c32cf78813ee3c7f076eed1e1d5e96 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@StateObject var viewModel = ViewModel()
@FocusState var isOrderIDFocused: Bool
var body: some View {
VStack {
Text("Orders")
TextField("Order ID", text: $viewModel.orderId, prompt: nil)
.focused($isOrderIDFocused)
Button("Search") {
viewModel.search()
isOrderIDFocused = false
}
}
.padding()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment