Created
April 10, 2020 16:28
-
-
Save tikipatel/9c44a768562437e2e7e40630b57d7600 to your computer and use it in GitHub Desktop.
Defines a shape that is rounded with given corners and radius.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct RoundedCorner: Shape { | |
var radius: CGFloat | |
var corners: UIRectCorner | |
func path(in rect: CGRect) -> Path { | |
let path = UIBezierPath( | |
roundedRect: rect, | |
byRoundingCorners: corners, | |
cornerRadii: CGSize(width: radius, height: radius) | |
) | |
return Path(path.cgPath) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment