To set the font weight in SwiftUI, you need to use the .fontWeight()
modifier.
Here's an example of how to change the font weight to bold:
main.swift45 chars3 lines
You can also set the font weight to other values, such as regular, semibold, medium, and light:
main.swift205 chars12 lines
Make sure to import SwiftUI at the top of your Swift file:
main.swift15 chars2 lines
And don't forget to assign the modifier to a view, such as a Text
view in this example.
gistlibby LogSnag