Building out the UI by adding a text field and list
To build out our UI, first, we’ll add a text field view so the user can enter their answers, and then we’ll add a list view, so all of the user’s words can be listed in a table.
To do that, go into the body
property of ContentView
and remove the existing boilerplate code for the Text
and Image
views, and add the following code:
//MARK: - TEXTFIELD - LIST TABLE VStack(alignment: .center, spacing: 15) { //MARK: - TEXT FIELD AND LIST TextField("Enter your word", text: $appData.userEnteredWord) .textInputAutocapitalization(.never) ...