avatarSteven Curtis

Summarize

Overriding the default font in Swift

Want to change all of the default fonts in your App, in one fell swoop?

Prerequisites:

  • Be able to use Xcode (certainly to create an App!)
  • Be able to install custom fonts in your App

Terminology

TTF: TrueType Fonts, that were originally developed by Apple

OFT: OpenType Fonts, a relatively newer font that has been based on the TrueType standard

The implementation

You will need to have added a custom font into your project, and of course have linked to this through your .plist file. Done? No problem.

I set up a Resources.swift file with the following contents:

And then this can be called from AppDelegate (for example didFinishLaunchingWithOptions)

Conclusion

You can get a prototype App looking production ready faster than ever before using this technique. So why not get to it?

Questions?

Any queries? Get in touch using this Twitter channel:

I’d love to hear from you. Claps? If you like…

iOS
Swift Programming
Mobile App Development
Recommended from ReadMedium