Round corners with RoundedRect when rounding all corners (#1504)
This commit is contained in:
parent
9576470683
commit
48cf179691
|
@ -161,9 +161,14 @@ extension View {
|
|||
shadow(radius: 4, y: 2)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View {
|
||||
if corners == .allCorners {
|
||||
clipShape(RoundedRectangle(cornerRadius: radius))
|
||||
} else {
|
||||
clipShape(RoundedCorner(radius: radius, corners: corners))
|
||||
}
|
||||
}
|
||||
|
||||
/// Apply a corner radius as a ratio of a view's side
|
||||
func cornerRadius(ratio: CGFloat, of side: KeyPath<CGSize, CGFloat>, corners: UIRectCorner = .allCorners) -> some View {
|
||||
|
|
Loading…
Reference in New Issue