struct RoundedTextModifier: ViewModifier {
var bgColor: Color
var cornerRadius: CGFloat
func body(content: Content) -> some View {
content
.background(RoundedRectangle(cornerRadius: cornerRadius)
.foregroundColor(bgColor)
)
}
}
extension View {
func roundedBg(bgColor: Color, cornerRadius: CGFloat) -> some View {
return self.modifier(RoundedTextModifier(bgColor: bgColor, cornerRadius: cornerRadius))
}
}