Skip to content

Instantly share code, notes, and snippets.

@prafullakumar
Created January 24, 2021 13:25
Show Gist options
  • Save prafullakumar/368de7e87388c9cf9816af9638438bdc to your computer and use it in GitHub Desktop.
Save prafullakumar/368de7e87388c9cf9816af9638438bdc to your computer and use it in GitHub Desktop.
//step 1 -- Create a shape view which can give shape
struct CornerRadiusShape: Shape {
var radius = CGFloat.infinity
var corners = UIRectCorner.allCorners
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