Making Transparent Part Of Single Shape

Hi all.
Task: To make one-forth of the circle fully transparent.All of the space within the black triangle must be invisible.
Optional task: It could be great to put the entire triangle in the circle.I mean the apex is too high.

The repository below is for your convenience.

Pure code:

import SwiftUI

struct ContentView: View {
    var body: some View {
                .fill(LinearGradient(gradient: Gradient(colors: [.green, .yellow, .orange, .red,]), startPoint: .bottom, endPoint: .top ))
struct MyArc: Shape {
    func path(in rect: CGRect) -> Path {
        var path = Path()
        path.addArc(center: CGPoint(x: rect.midX, y: rect.midY),
                    radius: rect.size.width / 2,
                    startAngle: .degrees(0),
                    endAngle: .degrees(275),
                    clockwise: false)
        return path
struct Triangle: Shape {
    func path(in rect: CGRect) -> Path {
        var path = Path()
        path.move(to: CGPoint(x: rect.midX, y: rect.minY))
        path.addLine(to: CGPoint(x: rect.midX, y: rect.midY))
        path.addLine(to: CGPoint(x: rect.maxX, y: rect.midY))
        return path
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {

Thanks for your priceless time.

Answering my question.

            AngularGradient(gradient: Gradient(colors: [.red, .blue.opacity(0)]),
            center: .center, startAngle: .degrees(360), endAngle: .degrees(180) )

The best idea I came up with.
Screen Shot 2021-06-09 at 6.36.39 PM

Thanks, Dennis.
You are welcome, Dennis.

1 Like

LOL, FWIW, questions about Apple's framework, including SwiftUI, is out of the scope of this forum. You might have better luck next time over Apple Developer Forums.

Got you. Thanks. Where can I find info on the rules of this forum?

Formally, it's the Code of Conduct, but that just contains the normal stuff. Y'know, be nice, be polite. It definitely doesn't contain specifically things that are on/off topic and is probably not what you're looking for.

Closest I could find is probably from the reply of one of the moderator:

Plus fewer people are interested in Apple's framework here anyway. It's more like you wouldn't get much help or attention here, than it being forbidden.

Okay. Thanks for the info.