Post

Replies

Boosts

Views

Activity

iOS Widget - Trim not drawing
I am trying to make a circular progress bar for my widget, I am using this code to do so. On the base app content view, everything comes out how I want it to. But when I try the same view on my widget, Circle().trim seems to not allow a drawing to happen and the circle disappears completely. I have seen a couple of posts about this on the forums. I am currently running on Xcode 12.3      ZStack{       Color(red: 0, green: 0, blue: 0)       ZStack {         Circle()           .rotation(.degrees(112))           .trim(from:0.0, to: 0.87)           .stroke(style: StrokeStyle(lineWidth: 8.0, lineCap: .round))           .opacity(0.3)           .foregroundColor(Color.gray)           .frame(width: 120, height: 120, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)                   Circle()           .rotation(.degrees(112))           .trim(from:0.0, to: 0.2)           .stroke(style: StrokeStyle(lineWidth: 8.0, lineCap: .round, lineJoin: .round))           .foregroundColor(Color.white)           .frame(width: 120, height: 120, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)                             }       .padding()   }
8
0
1.7k
Jan ’21