title: SwiftUI: How to use a linear gradient in a progress bar?
body: <p>I'm trying to build a view that is a rounded rectangle in a bar chart, with a gradient that gets progressively darker the higher <code>value</code> is (value is on a 0-10.0 scale).  But I can't seem to figure how how to use <code>UnitPoint</code> here for endPoint to get the correct point where the gradient should end.  In other words if value = 5.0, I want the gradient to show the top of the bar as half way to the gradient's darkest color, or said another way the gradient's darkest color is always at 10.0 and the bar's color will only show as high as the bar is.</p>
  <pre><code>var body: some View {
      VStack {
          RoundedRectangle(cornerRadius: 5.0)
              .fill(LinearGradient(gradient: Gradient(colors: [ Color(UIColor(red: 0.98, green: 0.85, blue: 0.38, alpha: 1.00)) , Color(UIColor(red: 0.63, green: 0.02, blue: 0.11, alpha: 1.00))]), startPoint: .bottom, endPoint: UnitPoint(x: 0.5, y: CGFloat((value * 10 / 100)))))
              .frame(width: 40, height: open ? CGFloat(value * 10) : 0)
      }
      
  }
  </code></pre>