Custom Font not working

I added a custom font named Lemon-Regular, its a ttf file and I made sure that the project is checked in the font's target ownership and that it also occurs in the resources in build phases. The code doesnt throw up any error but the font itself is not being rendered. This is my code
Text(text)
.font(.custom("Lemon-Regular", size: 24))
.frame(width: 200, height: 50)
.foregroundStyle(isButtonClicked ? .black : .white)
.background(isButtonClicked ? .white : .clear)
.border(.white, width: 1.5)
.cornerRadius(5)
Text(text)
.font(.custom("Lemon-Regular", size: 24))
.frame(width: 200, height: 50)
.foregroundStyle(isButtonClicked ? .black : .white)
.background(isButtonClicked ? .white : .clear)
.border(.white, width: 1.5)
.cornerRadius(5)
1 Reply
chiellienl
chiellienl2y ago
Have you added it to your Info.plist as well? Example can be found here: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app
Apple Developer Documentation
Adding a Custom Font to Your App | Apple Developer Documentation
Add a custom font to your app and use it in your app’s interface.
Want results from more Discord servers?
Add your server