Creating a TextField with onCommit feature

Hello!

I'm having a little issue with the onCommit feature for TextField. Basically what I am trying to do is create a List with a Section header and a TextField inside, nothing crazy. My current code looks something like this:

struct FormView: View {
    @State private var myContent: String = ""
    var body: some View {
        Form {
           Section(header: Text("Name")) { 
              TextField("Contents", text: $myContent, axis: .vertical, onCommit: {
                   // Perform action on commit
                   updateData()
              })
           }
        }
    }

    private func updateData() {
        // Perform the data update here
    }
}

However, I am getting an error that says

Extra argument 'onCommit' in call

I'm able to get rid of the error by deleting either the axis: .vertical or the onCommit: {...}.

I do want both of these functionalities, though, as the axis: .vertical essentially wraps the text to a new line when needed and the onCommit: {...} updates my app database using UserDefaults.

Is there a way to create a TextField within a List and Section that has a $binding variable, axis, and onCommit functionality or am I dreaming?

Note: Form should be List, otherwise this code throws another error. I am aware of this typo.

Creating a TextField with onCommit feature
 
 
Q