. Using Bold And Italic In SwiftUI 4 - iappstop-Today's Technology

Using Bold And Italic In SwiftUI 4

Using Bold And Italic In SwiftUI 4

swiftui4-ios-16-iphone-better-apps-less-code Using Bold And Italic In SwiftUI 4

Hello, in this post I will share an example of how to make the Text object bold and italic directly with SwiftUI 4 With the method I show, you can control the bold and italic state of the text using state management.

struct BoldItalicExample: View {

    @State private var changeStyle: Bool = false

    var body: some View {
        Text("Hello, World!")
            .font(.system(size: 55))
            .bold(changeStyle)
            .italic(!changeStyle)
            .onTapGesture {
                changeStyle.toggle()
            }
    }
}
Source

Source: Using Bold And Italic In SwiftUI 4

Share this content:

Post Comment