As I continued working on MakeItSo this week, I realised that the app’s navigation bar title looks slightly different than Apple’s Reminder app. Turns out they started using round versions of the San Francisco font a while back.
I don’t know about you, but I’ve got the impression that SwiftUI seems to follow Alan Kay’s adage “Simple things should be simple, complex things should be possible”
) - specifying which font to use is a prime example of this principle!
SwiftUI defines a number of defaults for font styles most apps will be using over and over again, and these are defined as constants on
, and others are text styles you will find in almost any app.
In addition, you can easily string together your own font to meet your app’s needs. For example, here is how you can create a rounded variant of the system font for any text labels that are of the style body:
.font(.system(.body, design: .rounded))
By assigning this to the root view of your application, this font style will now be used in every view of your app’s view hierarchy.
Unfortunately, this doesn’t apply to the text labels in the navigation bar. To achieve this, we have to use fall back to UIKit and use the UIAppearance