我视图中有一个标签,我想使用系统字体的中等大小,大小为21点。
我创建了一个自定义扩展来重用所创建的字体:
I have a label in my view that I want to use the system font size in medium, with a size of 21 points.
I created a custom extension to re-use the font created:
extension Font {
static var primaryButton: Font {
return Font.custom("SFUIDisplay-Light", size: 21)
}
}
然而,这没有任何效果。我将字符串更改为HelveticaNeue-UltraLight
,它确实起作用了,所以我猜SFUIDisplay-Light
只是不正确的字体名称。
在字体册中,它说SFProText-Light
,但对我也没有起作用。
在SwiftUI中,三藩市字体的正确字体名称是什么?
或者:如何使用系统字体设置字体大小?