Input label - SwiftUI

In SwiftUI, we recommend combining a LabeledContent with a TextField or TextEditor to link a label to an input field.

@State private var name: String = ""

private var textFieldLabel = "Name"

var body: some View {
    Form {
        LabeledContent(textFieldLabel) {
            TextField("", text: $name)
                .textFieldStyle(RoundedBorderTextFieldStyle())
        }
    }
}