Use fonts in SwiftUI

Hello there!
Does anyone know how to apply Apple's default fonts to text in SwiftUI?

Accepted Reply

Sure! So do soemthing like this:

Text("Hello World!").font(.custom("Copperplate", size: 33))
  • Right! Thanks very much ;)

Add a Comment

Replies

You don't give us much to go on! What have you tried so far?

Basically you just need to add the .font() modifier to any Text object. Like this:

Text("Hello, world")
				.font(.headline)

@SpiderKenny actually I want to change the style of the text.

.font(.system(size: 20))

will select the system font in size 20.

Is it what you are looking for ?

Sorry, I didn't express myself well... I need to change the text style and apply a font on it (like: Palatino, Gill Sans, Futura, SF Pro etc...).
Is it possible?

Sure! So do soemthing like this:

Text("Hello World!").font(.custom("Copperplate", size: 33))
  • Right! Thanks very much ;)

Add a Comment