title: SwiftUI Circular Stroke Gradient
body: <p>I have implemented a circular stroke as you can see in the picture below (of course without the numbers ).</p>
  
  <p>Unfortunately, I encounter two problems that you may be able to help me with.</p>
  
  <ol>
  <li><p>I want the <strong>gradient</strong> to go along the line, i.e. the darkest point in this picture should always be at the end of the stroke (1b) and not as currently at (1a)</p></li>
  <li><p>Is it possible to give a stroke a <strong>lineCap</strong> <code>.round</code> on one side and a lineCap <code>.butt</code> on the other side? I would like to have a rounded line end at (1b) and a straight line at (2), which corresponds to .butt. </p></li>
  </ol>
  
  <p>Here is my example code</p>
  
  <pre class="lang-swift prettyprint-override"><code>struct CircularGradientLine: View {
      private let gradient = LinearGradient(
          gradient: Gradient(colors: [StyleGuide.Color.primary, .white]),
          startPoint: .leading,
          endPoint: .trailing)
      public var body: some View {
          ZStack {
              Circle()
                  .stroke(Color.white, lineWidth: 46)
  
              Circle()
                  .trim(from: 0, to: CGFloat(0.8))
                  .stroke(gradient, style:
                      StrokeStyle(lineWidth: 46,
                                  lineCap: .round))
          }.padding(60)
      }
  }
  </code></pre>
  
  <p>I would be delighted if someone could help me there </p>
  
  <p><a href="https://i.stack.imgur.com/oD8ZI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oD8ZI.png" alt="enter image description here"></a></p>