iosswiftuiwatchoswidgetkitwatchos-10

WidgetKit watchOS 10 .accessoryCorner cannot figure out how to color a Gauge?


Not sure if its a watchOS 10 bug but I cannot figure out a way to get this Gauge to have any color, it always renders white in preview and on device?

  case .accessoryCorner:
      Text("\(75)%")
        .font(.system(size: 18))
          .fontWeight(.bold)
          .widgetLabel {
              Gauge(value: Double(recoveryScore), in: 0...100) {
                  Text("Not shown")
              } currentValueLabel: {
                  Text("Not shown")
              } minimumValueLabel: {
                  Text("0") // Watch out for clipping
              } maximumValueLabel: {
                  Text("100") // Watch out for clipping
              }
              
              .foregroundColor(.green) //.foregroundStyle doesn't work either

          }

Solution

  • 🤦‍♂️ I should have known, simply use .tint(.green)