You can use the Appearance API to ensure that all controls have the same font (at run time)
Take a look at the question how to set a font for UIButton with appearance.
For UILabel and UITextView, follow these steps: This can be done in the AppDelegate application(_:didFinishLaunchingWithOptions:)
let labelAppearance = UILabel.appearance() labelAppearance.font = UIFont.myFont() let textFieldAppearance = UITextView.appearance() textFieldAppearance.font = UIFont.myFont()
The previous solution, however, would not update the storyboard.
To visually see the changes in the storyboard, you can look in the function
prepareForInterfaceBuilder()
Here is the answer that explains how to get a visual update in the storyboard, but for this you will need to use custom classes for your text fields, buttons, etc.
Sample code according to the link above:
@IBDesignable public class MyUILabel: UILabel { public override func awakeFromNib() { super.awakeFromNib() configureLabel() } public override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() configureLabel() } func configureLabel() { font = UIFont(name: Constants.DefaultFont, size: 40) } }
source share