SwiftUI紧凑字体

问题描述 投票:0回答:1

如何使用系统字体的紧凑样式?

我以为我会是这样的人:

font(Font.system(size: 21, style: .compact))

SF Compact Display

ios swiftui typography
1个回答
0
投票

查看:

Text("Hello World")
    .h1()

扩展名:

extension Text {
    func h1() -> Text {
        self
            .foregroundColor(Color.init(hex: "#FFFFFF", alpha: 1.0))
            .font(.custom("SF Pro Display", size: 80))
    }
}

Text("Hello World")
    .font(.custom("SF Pro Display", size: 80))
© www.soinside.com 2019 - 2024. All rights reserved.