comparison GeoQuiz/Components/ProgressBarHelper.swift @ 16:1011e56b7832

implement user profile
author Dennis C. M. <dennis@denniscm.com>
date Thu, 20 Oct 2022 13:49:42 +0200
parents
children
comparison
equal deleted inserted replaced
15:f1967f8cc67b 16:1011e56b7832
1 //
2 // ProgressBarHelper.swift
3 // GeoQuiz
4 //
5 // Created by Dennis Concepción Martín on 20/10/22.
6 //
7
8 import SwiftUI
9
10 struct ProgressBar: View {
11 let pctScore: Double
12 let gradient: Gradient
13
14 var body: some View {
15 GeometryReader { geo in
16 ZStack(alignment: .leading) {
17 Capsule()
18 .foregroundColor(.customBackground)
19 .frame(height: 6)
20
21 Capsule()
22 .fill(
23 LinearGradient(
24 gradient: gradient,
25 startPoint: .trailing, endPoint: .leading
26 )
27 )
28 .frame(width: geo.size.width * pctScore, height: 6)
29 }
30 }
31 }
32 }
33
34 struct ProgressBar_Previews: PreviewProvider {
35 static var previews: some View {
36 ProgressBar(pctScore: 0.3, gradient: .main)
37 }
38 }