Andrew Fletcher published: 21 March 2019 (updated) 17 March 2020 1 minute read
For detailed notes regarding how to add custom fonts to your iOS app see Apple's custom font notes.
When using the font programmatically, remember that the font file name most of the time will not be the font name. For example, I wanted to use SF-Pro-Text-Bold and its font name is SFProText-Bold. If you want to check the font name, add the following script
for family in UIFont.familyNames.sorted() { let names = UIFont.fontNames(forFamilyName: family) print("Family: \(family) Font names: \(names)") }
You can view the current list of fonts at iOS Fonts.
The key step here is to ensure that you have added the custom fonts to your Info.plist
Related articles
Andrew Fletcher
•
11 Jun 2021
Starting a new GitHub repository including having to merge
Wanting to create a new repository on GitHub, add in a few of the available options that can come with an initial repository such as:
.gitignore for the platform you are building on
README.md for detailed notes - particularly if the repository if public
LICENSE - again important if the...
Andrew Fletcher
•
29 Dec 2020
SwiftUI - publishing changes from background threads is not allowed
The purple warning notification of annoyance recently came my way! I received the following warning:
Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
What was...
Andrew Fletcher
•
28 Dec 2020
Validating email in Swift or SwiftUI
I'm currently working on a project that requires login, register, forget password functionality in SwiftUI. As I'm developing the code, I came across a great resource for validating an email address with Regex:
http://emailregex.com/
In the end, I leveraged the worked produced...