Giter Club home page Giter Club logo

fontblaster's Introduction

FontBlaster

Programmatically load custom fonts into your iOS app.


About

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

Changelog

v1.0.3

  • Now there's only one method, blast(_:), which defaults to NSBundle.mainBundle() if no arguments are passed.

v1.0.2

Features

  • CocoaPods Support
  • Automatically imports fonts from NSBundle.mainbundle()
  • Automatically imports fonts from bundles inside your mainBundle
  • Able to import fonts from remote bundles
  • Sample Project

Installation Instructions

CocoaPods Installation (iOS 8+)

pod 'FontBlaster'
  • Add import FontBlaster to any .Swift file that references Siren via a CocoaPods installation.
  • Requires CocoaPods 0.36 prerelease or later

Manual Installation (iOS 7+)

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

Setup Instructions

Typically, all fonts are automatically found in NSBundle.mainBundle(). 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 NSBundle.mainBundle() 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 NSBundle in the blast(_:) method:

FontBlaster.blast(_:) // Takes one argument of type NSBundle, or as mentioned above, defaults to NSBundle.mainBundle() if no arguments are passed

To turn on console debug statements, simply set debugEnabled() = 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. After pushing the button, FontBlaster imports your fonts and redraws the view.

Special Thanks

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

Created and maintained by

Arthur Ariel Sabintsev

fontblaster's People

Contributors

artsabintsev avatar natecook1000 avatar

Watchers

James Cloos avatar Carabineiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.