How to add .fontWeight as part of a ViewModifer in SwiftUI

G

Gavin Jensen

Guest
I am trying to create ViewModifiers to hold all my type styles in SwiftUI. When I try to add a .fontWeight modifier I get the following error: Value of type 'some View' has no member 'fontWeight'

Is this possible? Is there a better way to manage type styles in my SwiftUI project?

struct H1: ViewModifier {
func body(content: Content) -> some View {
content
.foregroundColor(Color.black)
.font(.system(size: 24))
.fontWeight(.semibold)
}
}

Continue reading...
 
Top