🔹view.foregroundStyle()

SwiftUIviewdrawingforegroundstyle.foregroundStyle()

If you want to fill a single Shape instance, use fill(style:) instead. 👉 Apple ⟩ view.foregroundStyle()

HStack {
    Image(systemName: "triangle.fill")
    Text("Hello, world!")
    RoundedRectangle(cornerRadius: 5)
        .frame(width: 40, height: 20)
}
// ⭐️ view.foregroundStyle(shapeStyle)
.foregroundStyle(.teal)

Last updated

Was this helpful?