Placeholders for text fields embedded in forms (macOS)

It seems like there's no way to set a placeholder in a text field when it is in a form on macOS. This is not an issue on iOS.

import SwiftUI

struct ContentView: View {
    @State private var textUp = ""
    @State private var textDown = ""
    
    var body: some View {
        VStack {
            Form {
                Text("In a form:")
                    .fontWeight(.bold)
                
                TextField("placeholder", text: $textUp)
            }
            
            Text("Not in a form:")
                .fontWeight(.bold)
            TextField("placeholder", text: $textDown)
        }
        .padding()
    }
}

Am I missing something or is this just not supported?

Answered by Frameworks Engineer in 744265022

You could write like this

TextField("title", text: $textUp, prompt: Text("placeholder"))
Accepted Answer

You could write like this

TextField("title", text: $textUp, prompt: Text("placeholder"))
Placeholders for text fields embedded in forms (macOS)
 
 
Q