How do you set placeholder text in a TextField to italics?

Viewed 113

We can set italics on Text with the .italic() modifier, but how would you set italics in a TextField View for the placeholder text?

struct TextFieldItalics: View {
    @State private var username: String = ""
    
    var body: some View {
        VStack {
            Text("Hello, World!")
                .italic()
            TextField("Add username", text: $username)
        }
    }
}

enter image description here

1 Answers

With font modifier:

.font(Font.body.italic())
Related