Skip to content

Instantly share code, notes, and snippets.

@Plnda
Last active January 20, 2020 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Plnda/121b5960807074cf5fd68c68f959aa54 to your computer and use it in GitHub Desktop.
Save Plnda/121b5960807074cf5fd68c68f959aa54 to your computer and use it in GitHub Desktop.
Group {
VStack(alignment: .center) {
ZStack {
Circle()
.fill(AssetColors.color(.onBlueColor))
.frame(width: scale - degreeLength, height: scale - degreeLength, alignment: .center)
Circle()
.stroke(AssetColors.color(.secondaryTextColor), style: StrokeStyle(lineWidth: degreeLength, lineCap: .butt, lineJoin: .miter, dash: [4]))
.frame(width: scale, height: scale, alignment: .center)
Circle()
.trim(from: 0.0, to: value * step)
.stroke(AssetColors.color(.offTextColor), style: StrokeStyle(lineWidth: degreeLength, lineCap: .butt, lineJoin: .miter, dash: [4]))
.rotationEffect(.degrees(-90))
.animation(.default)
.frame(width: scale, height: scale, alignment: .center)
Text("\(value, specifier: "%.1f") \u{2103}")
.font(.largeTitle)
.foregroundColor(Color(.white))
.fontWeight(.semibold)
.fixedSize()
}
}
.onTapGesture {
self.value = min(max(self.maxTemperature, 0), self.value + self.modifyDegrees)
}
.onAppear(perform: {
self.value = 10
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment