Changing font programmatically to System Semibold

The system font for iOS, starting in iOS 9, is “San Fransisco.” To get a semibold version, you could use something along the lines of:

Swift 2.2:

UIFont.systemFontOfSize(20, weight: UIFontWeightSemibold)

Swift 3.0:

UIFont.systemFont(ofSize: 20, weight: UIFontWeightSemibold)

Swift 4.0:

UIFont.systemFont(ofSize: 20, weight: .semibold)

For more information on this, see the UIFont Class Reference.

Leave a Comment