This repository was archived by the owner on Oct 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHomeScreen.swift
More file actions
134 lines (117 loc) · 5.14 KB
/
HomeScreen.swift
File metadata and controls
134 lines (117 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import SwiftUI
import OpenIAP
@available(iOS 15.0, *)
struct HomeScreen: View {
var body: some View {
GeometryReader { geometry in
ScrollView {
VStack(spacing: 20) {
Spacer(minLength: 0)
VStack(alignment: .leading, spacing: 16) {
HStack {
Image(systemName: "bag.fill")
.font(.largeTitle)
.foregroundColor(AppColors.primary)
VStack(alignment: .leading, spacing: 4) {
Text("OpenIAP Example")
.font(.headline)
Text("iOS")
.font(.caption)
.padding(.horizontal, 8)
.padding(.vertical, 2)
.background(AppColors.secondary.opacity(0.2))
.cornerRadius(4)
}
Spacer()
}
Text("Test in-app purchases and subscription features with StoreKit integration.")
.font(.subheadline)
.foregroundColor(.secondary)
}
.padding()
.background(AppColors.cardBackground)
.cornerRadius(12)
.shadow(radius: 2)
.padding(.horizontal)
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 16), count: 2), spacing: 16) {
FeatureCard(
title: "Purchase\nFlow",
subtitle: "Test product purchases",
icon: "cart.fill",
color: AppColors.primary,
destination: AnyView(PurchaseFlowScreen())
)
FeatureCard(
title: "Subscription\nFlow",
subtitle: "Test subscriptions",
icon: "repeat.circle.fill",
color: AppColors.secondary,
destination: AnyView(SubscriptionFlowScreen())
)
FeatureCard(
title: "My\nPurchases",
subtitle: "View your purchases",
icon: "list.bullet.rectangle.fill",
color: AppColors.success,
destination: AnyView(AvailablePurchasesScreen())
)
FeatureCard(
title: "Offer\nCode",
subtitle: "Redeem promotional codes",
icon: "gift.fill",
color: AppColors.warning,
destination: AnyView(OfferCodeScreen())
)
}
.padding(.horizontal)
Spacer(minLength: 0)
}
.padding(.vertical)
.frame(minHeight: geometry.size.height)
}
}
.background(AppColors.background)
.navigationTitle("OpenIAP Features")
.navigationBarTitleDisplayMode(.large)
}
}
struct FeatureCard: View {
let title: String
let subtitle: String
let icon: String
let color: Color
let destination: AnyView
var body: some View {
NavigationLink(destination: destination) {
VStack(spacing: 8) {
Spacer()
Image(systemName: icon)
.font(.system(size: 34))
.foregroundColor(color)
.frame(height: 40)
VStack(spacing: 4) {
Text(title)
.font(.system(size: 15, weight: .semibold))
.multilineTextAlignment(.center)
.lineLimit(2)
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(.primary)
Text(subtitle)
.font(.system(size: 11))
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
.lineLimit(2)
}
Spacer()
}
.frame(height: 140)
.frame(maxWidth: .infinity)
.padding(.horizontal, 12)
.padding(.vertical, 16)
.background(AppColors.cardBackground)
.cornerRadius(12)
.shadow(radius: 2)
}
.buttonStyle(PlainButtonStyle())
}
}