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
🕓 1 year 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: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.1.0
1 year ago
  • Add documentation to help with code completion

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