How to Use Custom Fonts With SwiftUI

Muhammad Naufal Adli
2 min readSep 24, 2023

--

Seponsbob’s epic essay (source: Gifrer)

Create New Project in ( x code )

open Application x code dan make new project.

created new project

provide a product name and select the language (language) swift, make sure the user interface is Swift UI.

Add custom fonts to the project. which are in .otf and .ttf format. create a new folder then enter the font file into that folder.

Fonts file

Navigate to Info.plist and add fonts (Fonts provided by application)
after inputting the font file into the project file. navigate directly to the info key( information property list ) file.

info.plist

Click + add icon in the Information property list and look for Fonts provided by application. select / enter. then we create a new array with the name of the font file that we will use.

After that we can use the font file that we entered in the project. then apply the font like the code below, make sure the custom font matches the file name in the info plist.

Text("Madtive")
.font(.custom("Quicksand-Bold.ttf", size: 48))
Gambar custom font

after that we can also customize the font combination by adding color, weight and size. as follows :

Created by Naufal adli

Thanks for reading! Stay tuned for more SwiftUI articles by Muhammad Naufal Adli. which will be coming soon and dont forget to clap. this artikel make Hand-crafted & Made with❤️.

--

--