Elefont 1.0.2

Elefont 1.0.2

Maintained by Mihai Cristian Tanase.

Elefont 1.0.2

  • By
  • Mihai Cristian Tanase


Load fonts in your iOS app without any hassle

Swift Support Platform CocoaPods



  • you want an effortless way of adding and using custom fonts in your iOS projects
  • you want to load fonts from your custom Bundle(s)
  • you want to load and use fonts not bundled with the app

then Elefont is what you need.


  • Imports fonts from Bundle.main
  • Imports fonts from custom Bundle(s)
  • Imports fonts from any local URL or path
  • CocoaPods Support



pod 'Elefont'


  1. Download Elefont.
  2. Copy Sources/Elefont.swift into your project.


A typical custom font integration without Elefont goes like this:

  1. Include your fonts to the Xcode project;
  2. Create a list with those fonts and update the Info.plist file;
  3. Use the fonts in the Storyboard/Xib or programmatically with
    UIFont(name: "<font-postscript-name>", size: <size>)

If you've integrated custom fonts in your iOS projects (I'm assuming you did given that you looked for a better solution here), then you know what a hassle step 2 (ex: wrong font file names) and step 3 (wrong font PostScript names, which is not the font file names).

Luckily, Elefont solves those two annoyances with this line:


which will load all the fonts in Bundle.main, completely removing step 2 and providing the PostScript names for the loaded fonts.

But what if your fonts are in a custom Bundle? Well, no problem:

Elefont.eat(bundle: <custom_bundle_object>)

I've mentioned earlier that Elefont can load fonts from local URL or path. Here's how you can do that:

// or

Each of the methods above can be called with a completion handler, in case you need a list of all of the loaded fonts generated by the load operation:

Elefont.eat(/* arguments */) { fonts in

If you need to debug font loading, set debugEnabled = true:

Elefont.debugEnabled = true

Public API

Below are all the possible variations of Elefont usage (fonts is an array of Strings containing PostScript font names):

// 1. Load from main Bundle without callback

// 2. Load from main Bundle with callback
Elefont.eat { fonts in

// 3. Load from custom Bundle without callback

// 4. Load from custom Bundle with callback
Elefont.eat(bundle:) { fonts in

// 5. Load from local URL without callback

// 6. Load from local URL with callback
Elefont.eat(at:) { fonts in

// 7. Load from local path without callback

// 8. Load from local path with callback
Elefont.eat(atPath:) { fonts in

Demo Project

You can use the ElefontDemo/ElefontDemo.xcodeproj project to see Elefont for loading fonts from main Bundle and from a URL path. Press "Load fonts" button to see the texts update with their corresponding fonts.

Created and maintained by

Mihai Cristian Tanase