FontBlaster

6.0.1

Programmatically load custom fonts into your iOS, macOS and tvOS app.
ArtSabintsev/FontBlaster

What's New

6.0.1

2026-07-08T00:05:20Z

What's Changed

Refinements from a peer code review of 6.0.0 (review by Codex, fixes by Claude).

  • Reverted the @MainActor isolation introduced in 6.0.0. It broke consumers calling blast() from background threads or nonisolated synchronous code. Shared state is now protected by an internal lock instead, restoring the pre-6.0 call-from-anywhere contract while remaining safe under Swift 6 strict concurrency (verified with a strict-concurrency client on a background queue).
  • Already-registered fonts are now reported as loaded. Re-blasting a bundle (or blasting a font registered earlier in the process) previously treated CoreText's already-registered error as a failure and reported nothing; those fonts' PostScript names are now still returned, and loadedFonts is explicitly de-duplicated.
  • Hidden files are skipped during scanning, so AppleDouble ._* sidecar files no longer produce noisy registration failures.
  • Documented that registered fonts are file-backed: don't move or delete a font file while it's registered.
  • Expanded the test suite: out-of-bundle directories (verifying .process-scope registration works outside the app bundle on iOS), uppercase extensions, paths with spaces, invalid font files, and already-registered reporting. CI now runs the tests on an iOS Simulator in addition to macOS.
  • Fixed invalid FontBlaster.blast(bundle:) placeholder calls in the README examples.

Full Changelog: 6.0.0...6.0.1

FontBlaster

Programmatically load custom fonts into your iOS, macOS, and tvOS app.

Swift Support Platform SwiftPM Compatible


About

Say goodbye to importing custom fonts via property lists as FontBlaster automatically imports and loads all fonts in your app's Bundles with one line of code.

Features

  • Swift Package Manager Support
  • Automatically imports fonts from Bundle.main
  • Able to import fonts from remote bundles
  • Scans subdirectories and nested bundles recursively
  • Supports .ttf, .otf, and .ttc font files
  • Sample Project

Requirements

  • iOS 17.0+ / tvOS 17.0+ / macOS 14.0+
  • Swift 5.9+

Installation Instructions

Swift Package Manager

.package(url: "https://github.com/ArtSabintsev/FontBlaster.git", from: "6.0.0")

Manual

  1. Download FontBlaster.
  2. Copy FontBlaster.swift into your project.

Setup

Typically, all fonts are automatically found in Bundle.main. Even if you have a custom bundle, it's usually lodged inside of the mainBundle. Therefore, to load all the fonts in your application, irrespective of the bundle it's in, simply call:

FontBlaster.blast() // Defaults to Bundle.main if no arguments are passed

If you are loading from a bundle that isn't found inside your app's mainBundle, simply pass a reference to your Bundle in the blast(bundle:) method:

FontBlaster.blast(bundle: myCustomBundle)

If you need a list of all of the loaded fonts, an overloaded version of the blast(bundle:) method has a completion handler that returns just that. Just like the original method, this method takes either a custom Bundle or defaults to Bundle.main if no argument is passed.

// Defaults to Bundle.main as no argument is passed
FontBlaster.blast() { fonts in
  print(fonts) // fonts is an array of Strings containing font names
}

// Custom bundle is passed as argument
FontBlaster.blast(bundle: myCustomBundle) { fonts in
  print(fonts) // fonts is an array of Strings containing font names
}

Registered fonts are file-backed, so don't move or delete a font file after it has been loaded.

To turn on console debug statements, simply set debugEnabled to true before calling either blast() method:

FontBlaster.debugEnabled = true
FontBlaster.blast()

Sample Project

A Sample iOS project is included in the repo. When you launch the app, all fonts are configured to load custom fonts, but don't actually display them until you push the button on the navigation bar. After pushing the button, FontBlaster imports your fonts and redraws the view.

Inspiration

This project builds upon an old solution that Marco Arment proposed and wrote about on his blog.

Created and maintained by

Arthur Ariel Sabintsev

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Jul 13 2026 11:25:24 GMT-0900 (Hawaii-Aleutian Daylight Time)