added iOS source code
[wl-app.git] / iOS / Pods / FontBlaster / README.md
1 # FontBlaster
2
3 ### Programmatically load custom fonts into your iOS app.
4
5 ![Swift Support](https://img.shields.io/badge/Swift-3.1%2C%203.2%2C%204.0-orange.svg)
6
7 [![CocoaPods](https://img.shields.io/cocoapods/v/FontBlaster.svg)](https://cocoapods.org/pods/FontBlaster)  [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![SwiftPM Compatible](https://img.shields.io/badge/SwiftPM-Compatible-brightgreen.svg)](https://swift.org/package-manager/) [![CocoaPods](https://img.shields.io/cocoapods/dt/FontBlaster.svg)](https://cocoapods.org/pods/FontBlaster) [![CocoaPods](https://img.shields.io/cocoapods/dm/FontBlaster.svg)](https://cocoapods.org/pods/FontBlaster)
8 ---
9 ## About
10
11 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.
12
13 ## Features
14 - [x] CocoaPods Support
15 - [x] Carthage Support
16 - [x] Swift PM Support
17 - [x] Automatically imports fonts from `Bundle.main`
18 - [x] Able to import fonts from remote bundles
19 - [x] Sample Project
20 - [x] Documentation at http://sabintsev.com/FontBlaster/
21
22 ## Installation Instructions
23
24 | Swift Version |  Branch Name  | Will Continue to Receive Updates?
25 | ------------- | ------------- |  -------------
26 | 4.0  | master   | **Yes**
27 | 3.2  | swift3.2 | No
28 | 3.1  | swift3.1  | No
29
30 #### CocoaPods
31 For Swift 4 support:
32 ```ruby
33 pod 'FontBlaster'
34 ```
35
36 For Swift 3.2 support:
37 ```ruby
38 pod 'FontBlaster', :git => 'https://github.com/ArtSabintsev/FontBlaster.git', :branch => 'swift3.2'
39 ```
40
41 For Swift 3.1 support:
42 ```ruby
43 pod 'FontBlaster', :git => 'https://github.com/ArtSabintsev/FontBlaster.git', :branch => 'swift3.1'
44 ```
45
46 ### Carthage
47 For Swift 4 support:
48
49 ```swift
50 github "ArtSabintsev/FontBlaster"
51 ```
52
53 For Swift 3.2 support:
54 ```swift
55 github "ArtSabintsev/FontBlaster", "swift3.2"
56 ```
57
58 For Swift 3.1 support:
59 ```swift
60 github "ArtSabintsev/FontBlaster", "swift3.1"
61 ```
62
63 ### Swift Package Manager
64 ``` swift
65 .Package(url: "https://github.com/ArtSabintsev/FontBlaster.git", majorVersion: 4)
66 ```
67
68 ### Manual
69
70 1. [Download FontBlaster](//github.com/ArtSabintsev/FontBlaster/archive/master.zip).
71 2. Copy `FontBlaster.swift` into your project.
72
73 ## Setup
74
75 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:
76
77 ```Swift
78 FontBlaster.blast() // Defaults to Bundle.main if no arguments are passed
79 ```
80
81 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(_:)` method:
82
83 ```Swift
84 FontBlaster.blast(bundle:) // Takes one argument of type Bundle, or as mentioned above, defaults to Bundle.main if no arguments are passed
85 ```
86
87 If you need a list of all of the loaded fonts, an overloaded version of the `blast(_:)` 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.
88
89 ```Swift
90
91 // Defaults to Bundle.main as no argument is passed
92 FontBlaster.blast() { (fonts) in
93   print(fonts) // fonts is an array of Strings containing font names
94 }
95
96 // Custom bundle is passed as argument
97 FontBlaster.blast(bundle:) { (fonts) in
98   print(fonts) // fonts is an array of Strings containing font names
99 }
100 ```
101
102 To turn on console debug statements, simply set `debugEnabled() = true` **before** calling either `blast()` method:
103
104 ```Swift
105 FontBlaster.debugEnabled = true
106 FontBlaster.blast()
107 ```
108
109 ## Sample Project
110 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.
111
112 ## Inspiration
113 This project builds upon an old solution that [Marco Arment](http://twitter.com/marcoarment) proposed and wrote about on his [blog](http://www.marco.org/2012/12/21/ios-dynamic-font-loading).
114
115 ## Created and maintained by
116 [Arthur Ariel Sabintsev](http://www.sabintsev.com/)