Skip to content

Commit

Permalink
Add materialStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
chFlorian committed Sep 12, 2021
1 parent dfd2d1a commit a135e93
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Sources/CommonStyles/ButtonStyles/MaterialButtonStyle.swift
Expand Up @@ -35,3 +35,23 @@ public struct MaterialButtonStyle: ButtonStyle {
)
}
}

@available(iOS 15.0, *)
extension View {
func materialStyle(_ material: Material = .regular, cornerRadius: CGFloat = 10) -> some View {
HStack {
Spacer()

self
.foregroundColor(.primary)
.font(Font.body.weight(.semibold))

Spacer()
}
.padding()
.background(
RoundedRectangle(cornerRadius: cornerRadius)
.foregroundStyle(material)
)
}
}

0 comments on commit a135e93

Please sign in to comment.