How To Set Custom Font Size In SwiftUI

To set the custom font size in SwiftUI there is .font view modifier that allows you to do it.

SwiftUI has some built-in font sizes and you can use one of them.

However, if you want to change font and size at the same time there is also an option to do it.

Let’s say you have a simple Text view.

Text(“Smash Swift!”)

To set few font name use Font.custom (.custom) inside .font view modifier.

Text(“Smash Swift!”)
font(.custom(“Georgia”, size: 30))

Now, the Text has a Georgia font and size 30.

If you don’t know what fonts are available, there is Apple’s website with all fonts: