Swiftpack.co - jiachenyee/Font as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by jiachenyee.
jiachenyee/Font 1.1.0
Make custom fonts accessible in SwiftUI
⭐️ 0
🕓 21 hours ago
iOS
.package(url: "https://github.com/jiachenyee/Font.git", from: "1.1.0")

Font

Easily use custom fonts within Swift Playgrounds projects!

image

Adding the Package

  1. Add a new Swift Package into the Swift Playgrounds project
  2. Paste in https://github.com/jiachenyee/Font as the Package URL.
  3. Select Add to Package

Implement font

Fonts without any weights

Text("Hello!")
    .font(.custom(.myFontName))

Fonts with weights

Regular/Default weight

Text("Hello!")
    .font(.custom(.myFontName()))

Other weights

Text("Hello!")
    .font(.custom(.myFontName(weight: .bold)))

Font customization

Default implementation

Text("Hello!")
    .font(.custom(.myFontName))

Custom font size

Text("Hello!")
    .font(.custom(.myFontName, size: 100))

[iOS 14] Relative fonts

Set font size relative to another font type using Apple's relativeTo: font sizes.

Text("Hello!")
    .font(.custom(.myFontName, size: 100, relativeTo: .title))

GitHub

link
Stars: 0
Last commit: Yesterday
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

1.1.0
Yesterday
  • Add documentation to help with code completion

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics