func foregroundColor (Color?) -> some View
Return Value 戻り値
A view with the default font set to the value you supply. あなたが提供する値に設定された省略時のフォントセットでのビュー。
Availability 有効性
Technology
A view with the default font set to the value you supply. あなたが提供する値に設定された省略時のフォントセットでのビュー。
font
The default font to use in this view.
Use font(_:)
to apply a specific font to all of the text in a view.
The example below shows the effects of applying fonts to individual views and to view hierarchies. Font information flows down the view hierarchy as part of the environment, and remains in effect unless overridden at the level of an individual view or view container.
Here, the outermost VStack
applies a 16-point system font as a default font to views contained in that VStack
. Inside that stack, the example applies a large
font to just the first text view; this explicitly overrides the default. The remaining stack and the views contained with it continue to use the 16-point system font set by their containing view:
VStack {
Text("Font applied to a text view.")
.font(.largeTitle)
VStack {
Text("These 2 text views have the same font")
Text("applied to their parent hierarchy")
}
}
.font(.system(size: 16, weight: .light, design: .default))
func foregroundColor (Color?) -> some View