

class UIFont : NSObject {class func systemFont(ofSize fontSize: CGFloat,weight: UIFont.Weight,width: UIFont.Width) -> UIFont
}
let condensed = UIFont.systemFont(ofSize: 46, weight: .bold, width: .condensed)
let compressed = UIFont.systemFont(ofSize: 46, weight: .bold, width: .compressed)
let standard = UIFont.systemFont(ofSize: 46, weight: .bold, width: .standard)
let expanded = UIFont.systemFont(ofSize: 46, weight: .bold, width: .expanded)
let uiFont = UIFont.systemFont(ofSize: 18, weight: .bold)
let font = Font(uiFont)
struct NewFontExample: View {let condensed = UIFont.systemFont(ofSize: 46, weight: .bold, width: .condensed)let compressed = UIFont.systemFont(ofSize: 46, weight: .bold, width: .compressed)let standard = UIFont.systemFont(ofSize: 46, weight: .bold, width: .standard)let expanded = UIFont.systemFont(ofSize: 46, weight: .bold, width: .expanded)var body: some View {VStack {Text("Compressed").font(Font(compressed))Text("Condensed").font(Font(condensed))Text("Standard").font(Font(standard))Text("Expanded").font(Font(expanded))}}
}
extension Font {public static func system(size: CGFloat,weight: UIFont.Weight,width: UIFont.Width) -> Font{// 1return Font(UIFont.systemFont(ofSize: size,weight: weight,width: width))}
}
Text("Compressed").font(.system(size: 46, weight: .bold, width: .compressed))
Text("Condensed").font(.system(size: 46, weight: .bold, width: .condensed))
Text("Standard").font(.system(size: 46, weight: .bold, width: .standard))
Text("Expanded").font(.system(size: 46, weight: .bold, width: .expanded))


Text("Pet Friends").font(Font(UIFont.systemFont(ofSize: 46, weight: .light, width: .expanded)))
Text("OVER THE YEARS").font(Font(UIFont.systemFont(ofSize: 30, weight: .thin, width: .compressed)))Text("Pet Friends").font(Font(UIFont.systemFont(ofSize: 46, weight: .black, width: .condensed)))
Text("OVER THE YEARS").font(Font(UIFont.systemFont(ofSize: 20, weight: .light, width: .expanded)))



上一篇:写出仿生学的例子(6句)
下一篇:形容“女生很痞”的句子有哪些?