Is it possible to change “return” key to “done” on keyboard with SwiftUI?

iOS 15

You can change the return key for each textField with a simple modifier called: submitLabel that takes the return key type:

enter image description here
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.

⚠️ Seems like there is a bug on Xcode 13 beta 1 that prevents this modifier from working in some situations.

Leave a Comment