Reading time: 1 min
This quick recipe show how to list and display all the fonts that are available by default in your iOS/MacOS app.
The end result looks like this:
Here's the code:
let allFontNames = UIFont.familyNames
.flatMap { UIFont.fontNames(forFamilyName: $0) }
var body: some View {
List(allFontNames, id: \.self) { name in
Text(name)
.font(Font.custom(name, size: 12))
}
}
Search our recipes
Related Posts
- 100 Styling and Customizing Tooltips in SwiftUI with TipKit
- 100 Break Up Your Views for Faster SwiftUI Build Times
- 100 Swift 5.5 Concurrency async/await Cheatsheet with Examples
- 100 SwiftUI TabView Styling (All iOS Versions)
- 100 Markdown in SwiftUI Text
Check out the companion apps!
Our free companion app and XCode Extension brings 100+ SwiftUI recipes right at your fingertips! Get a preview of it in the Online Companion.
Have a recipe for us?
Get in touch and let's grow the cookbook together!