I have this textField:
TextField("Username", text: $username).textFieldStyle(PlainTextFieldStyle())
How can I change its keyboard return button to the Done button?
iOS 15
You can change the return key for each textField
with a simple modifier called: submitLabel
that takes the return key type:
Image from WWDC21
Also, as you can see, you can have a callback to handle the return key press action just like the old textFieldShouldReturn
function that is accessible by .onSubmit
modifier.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.