Font Width in SwiftUI

One often overlooked element in mobile application design is the font. While the focus during design and development typically centers on colors and images, paying attention to font choice can significantly enhance your app’s appeal. If you’re interested in giving your app a unique improvement that sets it apart, this insightful post is for you.

In SwiftUI are existing four value for the font width:

  • Standard
  • Compressed
  • Expanded
  • Condensed

In the code:

struct ContentView: View {
    var body: some View {
        VStack {
            Text("Hello world")
                .fontWidth(.compressed)
            Text("Hello world")
                .fontWidth(.expanded)
            Text("Hello world")
                .fontWidth(.condensed)
        }.font(.largeTitle)
    }
}

To have this:

How you can see it’s very simple to have nice screen changing only the font width.

Note: English is not my native language, so I apologize for any errors. I use AI solely to generate the banner of the post; the content is human-generated.

To subscribe to my newsletter [https://nicoladefilippo.com/#mailinglist]

share this post with friends

Picture of Nicola De filippo

Nicola De filippo

I'm a software engineer who adds to the passion for technologies the wisdom and the experience without losing the wonder for the world. I love to create new projects and to help people and teams to improve

Leave a comment

Your email address will not be published. Required fields are marked *

Who I am

I'm a software engineer who adds to the passion for technologies the wisdom and the experience without losing the wonder for the world. I love to create new projects and to help people and teams to improve.

Follow Me Here

Get The Latest Updates

Periodically receive my super contents on coding and programming

join the family;)

Recent Posts