How to bold text in SwiftUI TextField? How to bold text in SwiftUI TextField? ios ios

How to bold text in SwiftUI TextField?


A general approach for using standard font size options and weights that work with SwiftUI TextField. For example:

TextField("Name", text: $name)  .font(Font.headline.weight(.light))

Available standard size options (smallest to largest):

.caption.footnote.subheadline.callout.body.headline.title3.title2.title.largeTitle

Available standard font weights (lightest to heaviest):

.ultralight.thin.light.regular.medium.semibold.bold.heavy.black


import SwiftUIstruct ContentView: View {    @State var TextValue: String = "Hello"    var body: some View {        VStack {            TextField("placeholder", text: $TextValue)            .padding(.horizontal, 50)                .font(.system(size: 30, weight: .heavy, design: .default))        }    }}struct ContentView_Previews: PreviewProvider {    static var previews: some View {        ContentView()    }}

enter image description here


TextField("Name", text: $name)    .font(Font.body.bold())