Skip to content

Instantly share code, notes, and snippets.

@kylejohnsonkj
Created March 16, 2018 22:09
Show Gist options
  • Save kylejohnsonkj/0193705fff4065209532400a59c47a99 to your computer and use it in GitHub Desktop.
Save kylejohnsonkj/0193705fff4065209532400a59c47a99 to your computer and use it in GitHub Desktop.
Adding a custom font to a Swift playground (Swift 4)
let fontPath = Bundle.main.path(forResource: "Custom Font", ofType: "ttf", inDirectory: "fonts")
let fontURL = NSURL(fileURLWithPath: fontPath!)
CTFontManagerRegisterFontsForURL(fontURL, CTFontManagerScope.process, nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment