Home > front end >  How I change the weight from a text button?
How I change the weight from a text button?

Time:07-08

i have a problem, i am trying to change the font weight from a button, but only bold works, if i change to medium or regular, don't work. I using xcode 13.

the code

            Button("Login") {
            }.font(.title.bold())
            .font (.title3)
            .foregroundColor(.white)
            .padding(20)
            .frame(maxWidth: .infinity)
            .background(Color("ButtonColor"))
            .cornerRadius(4.0)
            

CodePudding user response:

Use it like

    Button("Login") {
    }
    .font(.title.weight(.heavy))   // << here !!

demo

  • Related