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:

preview

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))
  }
}

Next Post Previous Post