Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct NegativeProgressView: View {
- var goalValue: Double = 275
- var currentValue: Double = 285
- var body: some View {
- GeometryReader { geometry in
- let totalWidth = geometry.size.width
- ZStack(alignment: .leading) {
- Rectangle()
- .foregroundColor(Color.gray.opacity(0.3))
- Rectangle()
- .foregroundColor(currentValue >= goalValue ? Color.green : Color.red)
- .frame(width: CGFloat(abs(currentValue - goalValue) / goalValue) * totalWidth)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement