🔹view.foregroundStyle()
SwiftUI ⟩ view ⟩ drawing ⟩ foreground ⟩ style ⟩ .foregroundStyle()
設定前景元素的 ShapeStyle。
HStack {
Image(systemName: "triangle.fill")
Text("Hello, world!")
RoundedRectangle(cornerRadius: 5)
.frame(width: 40, height: 20)
}
// ⭐️ view.foregroundStyle(shapeStyle)
.foregroundStyle(.teal).foregroundStyle():設定前景元素的 ShapeStyle。foreground element:前景元素
Last updated
Was this helpful?