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ā (
source) - 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
Font
:
largeTitle
,
title
,
headline
,
body
,
caption
, 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 API: