Post

Replies

Boosts

Views

Activity

Help with two errors on .trim(from: 0, to: 1 - CGFloat(self.sliceSize)) * CGFloat(self.progress)) line
import SwiftUI import PlaygroundSupport struct ProgressView: View {     let gradientColors: [Color] = [Color( colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)), Color( colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0))]     let sliceSize = 0.35     let progress: Double          private let percentageFormatter: NumberFormatter = {         let formatter = NumberFormatter()         formatter.numberStyle = .percent         return formatter     } ()          init(_ progress: Double = 0.3) {         self.progress = progress     }          var body: some View {         GeometryReader { geometry in             ZStack {                 Group {                     Circle()                         .trim(from: 0, to: 1 - CGFloat(self.sliceSize))                         .stroke(self.strokeGradient, style: self.strokeStyle(with: geometry))                         .opacity(0.5)                     Circle()                       .trim(from: 0, to: 1 - CGFloat(self.sliceSize)) * CGFloat(self.progress))                     .stroke(self.strokeGradient, style: self.strokeStyle(with: geometry))                                                               } .rotationEffect(.degrees(90) + .degrees(360 * self.sliceSize / 2))             }         }     } }
4
0
582
Jun ’22