struct RoundSpecificCorners: View { var body: some View { Text("DevTechie") .font(.largeTitle) .foregroundColor(.white) .padding() .background(Color.orange) .cornerRadius(10) } }
struct RoundSpecificCorners: View { var body: some View { Text("DevTechie") .font(.largeTitle) .foregroundColor(.white) .padding() .background(Color.orange) .clipShape(RoundedRectangle(cornerRadius: 10)) } }
struct RoundSpecificCorners: View { var body: some View { Text("DevTechie") .font(.largeTitle) .foregroundColor(.white) .padding() .background(Color.orange, in: RoundedRectangle(cornerRadius: 10)) } }
struct RoundedCorner: 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) } }
extension View { func roundedCorner(_ radius: CGFloat, corners: UIRectCorner) -> some View { clipShape(RoundedCorner(radius: radius, corners: corners) ) } }
struct RoundSpecificCorners: View { var body: some View { Text("DevTechie") .font(.largeTitle) .foregroundColor(.white) .padding() .background(Color.orange) .roundedCorner(20, corners: [.bottomLeft, .topRight]) } }
struct RoundSpecificCorners: View { var body: some View { Text("DevTechie") .font(.largeTitle) .foregroundColor(.white) .padding() .background(Color.orange) .roundedCorner(20, corners: [.bottomLeft, .topRight, .bottomRight]) } }
With that we have reached the end of this article. Thank you once again for reading. Subscribe our weekly newsletter at https://www.devtechie.com