swift ui font weight code example
Example 1: how to bold text swiftui
import SwiftUI
struct 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()
}
}
Example 2: how to set the font of text in swiftui
Text("Simple Swift Guide").font(.system(size: 45, weight: .bold, design: .default))