An easy, swifty, and enum(ey) font manager for iOS
- Xcode 9+
- Swift 4+
- Access to font files to embed in project
pod 'FontBook'
Copy FontBook.swift
(link) into your Xcode project. Make sure to add it to your app's target in Xcode.
First, copy the font files you want to use into your project. FontBook uses UIFont at its core so it accepts all standard font file formats. Be sure to select the relevent target and make sure that "Copy items if needed" option is checked.
import FontBook
Create an enum with a raw value of FontBook
. For each font that you copied into your project, add a case and name it appropriately. Give each case a raw value matching the font file's name.
enum Fonts: FontBook {
case arial = "Arial"
case arialItalic = "Arial Italic"
case arialBold = "Arial Bold"
case arialBoldItalic = "Arial Bold Italic"
case helveticaNeue = "HelveticaNeue"
}
To access UIFont
:
let font = Fonts.arial.rawValue.of(size: 12, color: .black)
This project uses SemVer for versioning semantics. For all the available versions, see the tags on this repository.
- Brianna Lee - Owly Design - EightfoldYOGA
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details