comparison GeoQuiz/Components/UserProfile.swift @ 20:e281791e0494

finish implementation
author Dennis C. M. <dennis@denniscm.com>
date Sun, 23 Oct 2022 11:48:39 +0100
parents GeoQuiz/Components/UserProfileHelper.swift@f140bb277c96
children
comparison
equal deleted inserted replaced
19:f140bb277c96 20:e281791e0494
1 //
2 // UserProfile.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 }