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 Focus change in TextField and SecureField
- 100 SwiftUI Marquee
- 100 SwiftUI Segues
- 100 SwiftUI Image Picker
- 100 SwiftUI Toast
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!