I am getting the following error message when I add the Text modifier Bold;
Can anyone help?
CodePudding user response:
The sequence is a matter for SwiftUI. .bold() is modifier of Text so write .bold() modifier after Text statement.
Return type of .padding() and .foregroundColor(.red) is View.
Text("SomeText")
.bold()
.padding()
.foregroundColor(.red)
CodePudding user response:
I used the fontWeight(.bold) modifier immediately after the Text component. I am using SwiftUI 3.0 so I think that's why .bold isn't a member of Text()
CodePudding user response:
In SwiftUI 3 .bold() is a modifier of the font itself.
Text("Stephen Learmonth")
.padding()
.font(.title.bold())
.foregroundColor(.white)

