Using custom fonts in SwiftUI
iOS comes with many preinstalled fonts that can be safely used in SwiftUI.
However, sometimes the design needs some custom fonts because they might be a part of the brand of the app maker, for example.
In this recipe, we'll see how to import a couple of custom fonts to use for building a menu page of an Italian restaurant.
Getting ready
Create a SwiftUI app called MenuApp.
Copy the customs fonts Sacramento, Oleo Script Regular, and Oleo Script Bold, which you can find in the repo: https://github.com/PacktPublishing/SwiftUI-Cookbook/tree/master/Resources/Chapter13/recipe8.
To use the fonts, they must be declared in the Info.plist file. Add the font names to the entry Fonts provided by application in Info.plist. The value of each of them must be its complete font name:
Fig. 13.30 – Custom fonts in Info.plist
Finally, the fonts must be copied during the installation, so add them in the Copy Bundle Resources...