How To Change Text Font Size In SwiftUI

There is a simple view modifier to change the Text font size in SwiftUI called .font.

Let’s say you have some Text view.

Text(“Hello, world!”)

And you want to make it smaller or bigger but you don’t know how big the size should be. There are few font sizes already built it, for example, .title, .body or .headline.

Text(“Hello, world!”)
    .
font(.headline)

If you want to set your own size, there is Font.system (.system) that allows you to create a default font with the size parameter.

Text(“Hello, world!”)
    .
font(.system(size: 33))