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 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