In my SwiftUI project I have a placeholder that I want to be .heavy, but when I try to modify fontWeight it says that fontWeight is define on Text, what should I do?
This is the code:
TextField("", text: $MyModel.name[0])
.placeholder(when: MyModel.name[0].isEmpty) {
Text(player1)
.font(Font.custom("Life Savers", size: 26))
.fontWeight(.bold)
}
.font(Font.custom("Life Savers", size: 26))
//here it doesn't let me change the fontWeight to heavy
CodePudding user response:
for TextField
you use
.font(Font.custom("Life Savers", size: 26).weight(.heavy))