【发布时间】:2021-07-02 06:58:48
【问题描述】:
一直在尝试在SwiftUI 中实现SF Pro Display 字体,但没有成功!我已经在 Xcode 和 info.plist 文件中复制了这些文件。其他字体工作但SF Pro Display 不工作。有人可以帮忙吗?
[UPDATE: No need to import SF Fonts in Xcode. Xcode uses SF Pro Display Fonts by default]
扩展名:
extension Font {
struct SF {
static func regular(size: CGFloat) -> Font {
.custom("SF-Pro-Display-Regular", size: size)
}
static func light(size: CGFloat) -> Font {
.custom("SF-Pro-Display-Light", size: size)
}
static func medium(size: CGFloat) -> Font {
.custom("SF-Pro-Display-Medium", size: size)
}
}
在 SwiftUI 中
Text("81%")
.font(Font.SF.medium(size: 55))
.shadow(radius: 10, y: 5)
【问题讨论】:
标签: ios swift xcode fonts swiftui