Advertisement

As we developers create an app, we always want to put our customized touches to it.  Fortunately, Xcode and SwiftUI makes it easy to bring custom fonts to your apps.

Using a TextField allows a user to input data into the app.  But wouldn’t it be nice if you could customized the look of the text field with a font that would look great?  Here’s the code:

1 / Text(“What would you like to say?”)

2 / .bold()

3 / .font(.custom(“Times New Roman”, size: 30))

4 / .foregroundColor(Color.white)

5 / .multilineTextAlignment(.center)

The above is a standard text field with customization.  But look at line 3.  I use the standard font command with the word .custom and then the name of the font that I wish to have, and then the size of the font.

 

 

About Post Author

(Visited 151 times, 1 visits today)

Dan Uff
Senior Writer / Owner
https://www.compuscoop.com/