Recall & Review
beginner
What is a
TextField in iOS Swift?A
TextField is a UI element that lets users enter and edit text in an app. It looks like a box where you can type.Click to reveal answer
beginner
How do you create a simple
TextField in SwiftUI?Use
TextField("Placeholder", text: $variable) where variable stores the typed text.Click to reveal answer
intermediate
What is the purpose of the
@State property wrapper with a TextField?@State keeps track of the text typed by the user and updates the UI when the text changes.Click to reveal answer
intermediate
How can you customize the keyboard type for a
TextField?Use the
.keyboardType() modifier with options like .numberPad or .emailAddress to show the right keyboard.Click to reveal answer
beginner
Why is accessibility important for
TextField?Accessibility helps users with disabilities use the
TextField by providing labels and hints for screen readers.Click to reveal answer
Which SwiftUI code creates a
TextField with a placeholder "Enter name"?✗ Incorrect
The correct syntax is
TextField("Placeholder", text: $variable).What does the
@State property do when used with a TextField?✗ Incorrect
@State keeps the text value and updates the UI when it changes.How do you change the keyboard to show numbers only for a
TextField?✗ Incorrect
Use
.keyboardType(.numberPad) to show a number-only keyboard.Which modifier adds a label for screen readers to a
TextField?✗ Incorrect
.accessibilityLabel() provides a description for screen readers.What happens if you forget to bind a
TextField to a @State variable?✗ Incorrect
Without binding, the
TextField can’t save or show changes.Explain how to create a basic
TextField in SwiftUI and why binding with @State is necessary.Think about how the app remembers what the user types.
You got /3 concepts.
Describe how to improve accessibility for a
TextField in an iOS app.Consider users who rely on voice feedback.
You got /3 concepts.