iOS UIFont Declaring and initializing UIFont

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

You can declare a UIFont as follows:

var font: UIFont!

UIFont has more init() methods:

  • UIFont.init(descriptor: UIFontDescriptor, size: CGFloat)
  • UIFont.init(name: String, size: CGFloat)

Therefore, you can initialize a UIFont like this:

let font = UIFont(name: "Helvetica Neue", size: 15)

The default font is System, size 17.



Got any iOS Question?