Post

Replies

Boosts

Views

Activity

About iOS 14 Widget
I would like to create a widget with a half-circular progress bar. Like this: struct HalvedCircularBar: View {   @State var progress: CGFloat = 0.5   var body: some View {     VStack {       ZStack {         Circle()           .trim(from: 0.0, to: 0.5)           .stroke(Color.blue, style: StrokeStyle(lineWidth: 12.0, dash: [8]))           .frame(width: 200, height: 200)           .rotationEffect(Angle(degrees: -180))         Circle()           .trim(from: 0.0, to: progress/2)           .stroke(Color.blue, lineWidth: 12.0)           .frame(width: 200, height: 200)           .rotationEffect(Angle(degrees: -180))         Text("\(Int(self.progress*100))%")           .font(.custom("HelveticaNeue", size: 20.0))       }     }   } } It's ok in the playground and app, but it cannot appear in the widget. When I removed the  ".trim(from: 0.0, to: 0.5)" ,the circle appeared in the widget. Why is the trim() method not available in ios14 widget ?
1
0
358
Oct ’20