I want to use Dynamic Type
for all texts in my app. The font I use is Apple's San Francisco
.
I don't like the defaults one because they don't really use Bold
for text.
Here is a list with all of them:
Style Weight Point size Leading Tracking
--------------------------------------------------------
Large Title Regular 34pt 41pt 11pt
Title 1 Regular 28pt 34pt 13pt
Title 2 Regular 22pt 28pt 16pt
Title 3 Regular 20pt 25pt 19pt
Headline Semi-Bold 17pt 22pt. -24pt
Body Regular 17pt 22pt. -24pt
Callout Regular 16pt 21pt. -20pt
Subhead Regular 15pt 20pt. -16pt
Footnote Regular 13pt 18pt. -6pt
Caption 1 Regular 12pt 16pt 0pt
Caption 2 Regular 11pt 13pt 6pt
So is there a way to configure how exactly the text styles should be ?
One way to get different weights with Dynamic Type is to use other
UIFont
properties and methods in addition topreferredFont(forTextStyle:)
.You can use the
pointSize
property combined withUIFont.systemFont(ofSize:weight:)
to get a different weight:You can extend
UIFont
to provide any necessary conveniences. For example, if you needtitle1
andbody
styles in various weights, you can create this:Then, accessing various sizes and fonts is super easy: