How do you set font weight for ButtonStyle in SwiftUI

Hi,

I would like to ask how to change fontWeight of a button label within ButtonStyle. However I can't figure it how to do it.

This is my code:
Code Block swiftstruct CapsuleButtonStyle: ButtonStyle {    func makeBody(configuration: Self.Configuration) -> some View {        configuration.label            .font(.footnote)            .fontWeight(.bold) /* All modifiers work except this one*/            .foregroundColor(.white)            .padding(.horizontal, 11)            .padding(.vertical, 6)            .background(Color.blue)            .cornerRadius(.infinity)    }}


Thanks for your help
Answered by Head Gato in 625039022
I wonder if it’s “not allowed” to use .bold weight with .footnote style. What happens if you add .bold() modifier instead of specifying a weight?

I’d file a bug either way.
Accepted Answer
I wonder if it’s “not allowed” to use .bold weight with .footnote style. What happens if you add .bold() modifier instead of specifying a weight?

I’d file a bug either way.
The same result, still not working.
Same issue here. Still not working.
Use:

Code Block .font(Font.footnote.weight(.bold))

You can also use only:

.font(.footnote.bold())

i have tried all of them still not working !!!

Changing:

.font(.footnote)

To:

.font(.footnote.bold())

Didn't work? Make sure this change was the first modifier before all others..

How do you set font weight for ButtonStyle in SwiftUI
 
 
Q