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

implement user profile
author Dennis C. M. <dennis@denniscm.com>
date Thu, 20 Oct 2022 13:49:42 +0200
parents
children 8dac58bb4569
comparison
equal deleted inserted replaced
15:f1967f8cc67b 16:1011e56b7832
1 //
2 // UserProfileComponent.swift
3 // GeoQuiz
4 //
5 // Created by Dennis Concepción Martín on 20/10/22.
6 //
7
8 import SwiftUI
9
10 struct UserProfile: View {
11 @ObservedObject var user: User
12 @ObservedObject var storeKitRC: StoreKitRC
13
14 var body: some View {
15 HStack(spacing: 20) {
16 UserImage(uiImage: user.data.uiImage)
17
18 VStack(alignment: .leading, spacing: 8) {
19 Text(user.data.username)
20 .font(.title)
21 .fontWeight(.semibold)
22
23 if storeKitRC.isActive {
24 Text("Premium user ⭐️")
25 .foregroundColor(.secondary)
26 }
27 }
28
29 Spacer()
30 }
31 .padding()
32 .background(
33 RoundedRectangle(cornerRadius: 20)
34 .foregroundColor(.white)
35 )
36 }
37 }
38
39 struct UserProfile_Previews: PreviewProvider {
40 static var previews: some View {
41 UserProfile(user: User(), storeKitRC: StoreKitRC())
42 }
43 }