Learn Courses My Dashboard

Textfield: Title (or TitleKey) vs Prompt (what is the difference, if any?)

Currently I´m doing the iOS Design (SwiftUI) course.
While following Chris with the TextField styling, XCode notified me that some commands will be deprecated in a future version of iOS.

One is the
TextField(_ title: StringProtocol, text: Binding (String)) field; most likely the
TextField(_ title: StringProtocol, text: Binding (String), prompt: Text?) is the most similar.

The visual output of
TextField("Insert your username", text: $username) is exactly the same as
TextField(text: $username, prompt: Text("Insert your username")

I was wondering what is the difference between the Title and the prompt. Though I think that the “prompt: + String” is more descriptive, just writing the String is shorter. Is there any advantage to use the prompt: Text declaration than just the Text? (it puzzles me that Xcode is telling me that title/text will be deprecated, but title/text/prompt? is still OK and prompt is just an optional, so title/text is still OK …)

I think it’s more about removing the initializers with onCommit and onEditingChanged parameters in favor of the new onSubmit and FocusState features.