Mercurial > public > geoquiz
comparison GeoQuiz/Components/UserProfileHelper.swift @ 19:f140bb277c96
refactor code
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 23 Oct 2022 00:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
18:d20cf93c9812 | 19:f140bb277c96 |
---|---|
1 // | |
2 // UserProfileHelper.swift | |
3 // GeoQuiz | |
4 // | |
5 // Created by Dennis Concepción Martín on 18/10/22. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 struct UserProfile: View { | |
11 @ObservedObject var userController: UserController | |
12 @ObservedObject var storeKitController: StoreKitController | |
13 | |
14 @Binding var isShowing: Bool | |
15 | |
16 var body: some View { | |
17 VStack(spacing: 20) { | |
18 UserImage(userController: userController) | |
19 .frame(height: 150) | |
20 .shadow(radius: 10) | |
21 | |
22 VStack(spacing: 10) { | |
23 Text(userController.data.username) | |
24 .font(.title.bold()) | |
25 | |
26 if storeKitController.premiumIsActive { | |
27 Text("Premium user ⭐️") | |
28 .foregroundColor(.secondary) | |
29 } | |
30 } | |
31 | |
32 Button("Edit") { | |
33 isShowing = true | |
34 } | |
35 .buttonStyle(.borderedProminent) | |
36 } | |
37 } | |
38 } | |
39 | |
40 struct UserProfile_Previews: PreviewProvider { | |
41 static var previews: some View { | |
42 UserProfile(userController: UserController(), storeKitController: StoreKitController(), isShowing: .constant(true)) | |
43 } | |
44 } |