How to use TextField 2.0 in SwiftUI
Published in
3 min readMar 13, 2023
In WWDC 2021, Apple introduce additional features for TextField
further improving the component itself. You may look back at the previous article about TextField
that was written by me on how to utilize it’s capabilities to the maximum.
Prerequisites
To follow along this tutorial, you’ll need some basic knowledge in:
- A basic familiarity with Swift.
- At least Xcode 13
- iOS 15+
Submit Label
With submitLabel
, you can now choose from a variety of choices for user to tap on whenever they are done with the TextField
. This also work on SecureField
and TextView
.
Some of the choices are:
- continue
- done
- go
- join
- next
- return
- route
- search
- send
TextField("Name", text: $name)
.submitLabel(.next)