Use .smallCaps() in SwiftUI

2k views Asked by At

Im trying to change my text to small caps in SwiftUI. But I don't understand how to apply the Method to my text.

https://developer.apple.com/documentation/swiftui/font/3084273-smallcaps

I've tried different ways, here are two of them:

Text("Typography")
    .font(.system(size: 24))
    .fontWeight(.bold)
    .smallCaps()

-

 Text("Typography")
     .font(.system(.body, textStyle: .smallCaps))

How can I set my letters to small caps? I’m using Xcode 11.3.

Thank you!

1

There are 1 answers

1
Daniel On BEST ANSWER

That code finally worked for me:

Text("Typography")
    .font(Font.system(.body).smallCaps())