Swift: Custom Fonts. Slightly Less Awful.

I’m giving you a Nightcall, to tell you how I feel.

We’ve probably all been there. I know I have.

The Sketch file — or equivalent — has arrived from the design team, and contained within it is a mass of custom fonts that absolutely must be used.

Neatly managing custom fonts is a complete pain. Even if you only have one deviant font, having to plonk UIFont constructors all over your code is indescribably awful. Trying to come up with a cleaner solution is also awful, because it usually ends up just as unmanageable by the end of the project as the last time you tried. Or maybe that’s just me.

Five times now, I have tried to develop a robust and reusable solution to this problem. Four times I have failed to do so. Last week, I think I finally cornered an acceptable — dare I say reusable — solution, and that’s why I’m writing this post today.