Mercurial > public > geoquiz
view 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 |
line wrap: on
line source
// // ProgressBarHelper.swift // GeoQuiz // // Created by Dennis Concepción Martín on 20/10/22. // import SwiftUI struct ProgressBar: View { let pctScore: Double let gradient: Gradient var body: some View { GeometryReader { geo in ZStack(alignment: .leading) { Capsule() .foregroundColor(.customBackground) .frame(height: 6) Capsule() .fill( LinearGradient( gradient: gradient, startPoint: .trailing, endPoint: .leading ) ) .frame(width: geo.size.width * pctScore, height: 6) } } } } struct ProgressBar_Previews: PreviewProvider { static var previews: some View { ProgressBar(pctScore: 0.3, gradient: .main) } }