I'm trying to change the font throughout an iOS app in Swift. I'm currently using:
var size:CGFloat = 16
UILabel.appearance().font = UIFont(name: "Gudea", size: size)
Which changes every UILabel
in my app to be the correct font. However, all labels are changed to size 16 despite different sizes assigned in the Main.Storyboard
.
Is there a way to assign a font to every UILabel
without changing the sizes assigned in Main.Storyboard
?
or, perhaps,
Is there a better way to change the font used throughout the app?
Thanks!
UIFont
category and start using that when you assign fonts programmatically. – AdamPro13UIFont
category & create class methods like[UIFont standardGudea]
. This is also great when you have a bunch of colors that you use throughout your app. – AdamPro13