|
1
|
import SwiftUI |
|
2
|
|
|
3
|
@main |
|
4
|
struct ControlKitRunnerApp: App { |
|
5
|
var body: some Scene { |
|
6
|
WindowGroup { |
|
7
|
ControlKitShowcaseView() |
|
8
|
} |
|
9
|
} |
|
10
|
} |
|
11
|
|
|
12
|
private struct ControlKitShowcaseView: View { |
|
13
|
private let repositoryURL = URL(string: "https://github.com/ondeinference/xcrs-controlkit")! |
|
14
|
|
|
15
|
var body: some View { |
|
16
|
ZStack { |
|
17
|
LinearGradient( |
|
18
|
colors: [Color.controlKitGreen, Color(red: 0.04, green: 0.12, blue: 0.09)], |
|
19
|
startPoint: .topLeading, |
|
20
|
endPoint: .bottomTrailing |
|
21
|
) |
|
22
|
.ignoresSafeArea() |
|
23
|
|
|
24
|
ScrollView { |
|
25
|
VStack(alignment: .leading, spacing: 28) { |
|
26
|
HStack(spacing: 18) { |
|
27
|
logo |
|
28
|
VStack(alignment: .leading, spacing: 4) { |
|
29
|
Text("ControlKit") |
|
30
|
.font(.system(size: 40, weight: .bold, design: .rounded)) |
|
31
|
Text("Apple platform automation") |
|
32
|
.font(.title3) |
|
33
|
.foregroundStyle(Color.controlKitCream.opacity(0.78)) |
|
34
|
} |
|
35
|
} |
|
36
|
|
|
37
|
Text("A clean-room runner for reliable black-box testing across Apple platforms.") |
|
38
|
.font(.title2.weight(.medium)) |
|
39
|
.fixedSize(horizontal: false, vertical: true) |
|
40
|
|
|
41
|
statusCard |
|
42
|
informationCard |
|
43
|
|
|
44
|
Link(destination: repositoryURL) { |
|
45
|
Label("View project on GitHub", systemImage: "arrow.up.right") |
|
46
|
.font(.headline) |
|
47
|
.frame(maxWidth: .infinity) |
|
48
|
} |
|
49
|
.buttonStyle(.borderedProminent) |
|
50
|
.tint(Color.controlKitCream) |
|
51
|
.foregroundStyle(Color.controlKitGreen) |
|
52
|
} |
|
53
|
.foregroundStyle(Color.controlKitCream) |
|
54
|
.padding(32) |
|
55
|
.frame(maxWidth: 820) |
|
56
|
} |
|
57
|
.frame(maxWidth: .infinity, maxHeight: .infinity) |
|
58
|
} |
|
59
|
.frame(maxWidth: .infinity, maxHeight: .infinity) |
|
60
|
.frame(minWidth: UIScreen.main.bounds.width, minHeight: UIScreen.main.bounds.height) |
|
61
|
.ignoresSafeArea(.all) |
|
62
|
.statusBarHidden(true) |
|
63
|
} |
|
64
|
|
|
65
|
private var logo: some View { |
|
66
|
Text("XC\nRS") |
|
67
|
.font(.system(size: 30, weight: .black, design: .rounded)) |
|
68
|
.multilineTextAlignment(.center) |
|
69
|
.lineSpacing(-8) |
|
70
|
.foregroundStyle(Color.controlKitGreen) |
|
71
|
.frame(width: 96, height: 96) |
|
72
|
.background(Color.controlKitCream, in: RoundedRectangle(cornerRadius: 24)) |
|
73
|
} |
|
74
|
|
|
75
|
private var statusCard: some View { |
|
76
|
VStack(alignment: .leading, spacing: 14) { |
|
77
|
Label("Runner online", systemImage: "checkmark.circle.fill") |
|
78
|
.font(.headline) |
|
79
|
.foregroundStyle(.green) |
|
80
|
Text("The XCTest host is ready to receive ControlKit automation requests.") |
|
81
|
.foregroundStyle(Color.controlKitCream.opacity(0.78)) |
|
82
|
} |
|
83
|
.padding(22) |
|
84
|
.frame(maxWidth: .infinity, alignment: .leading) |
|
85
|
.background(.white.opacity(0.1), in: RoundedRectangle(cornerRadius: 20)) |
|
86
|
} |
|
87
|
|
|
88
|
private var informationCard: some View { |
|
89
|
VStack(alignment: .leading, spacing: 16) { |
|
90
|
infoRow(title: "Project", value: "XCRSControlKit") |
|
91
|
infoRow(title: "Creator", value: "smbCloud") |
|
92
|
infoRow(title: "Platform", value: "iOS and iPadOS") |
|
93
|
infoRow(title: "Purpose", value: "Native UI automation runner") |
|
94
|
} |
|
95
|
.padding(22) |
|
96
|
.frame(maxWidth: .infinity, alignment: .leading) |
|
97
|
.background(.white.opacity(0.08), in: RoundedRectangle(cornerRadius: 20)) |
|
98
|
} |
|
99
|
|
|
100
|
private func infoRow(title: String, value: String) -> some View { |
|
101
|
HStack { |
|
102
|
Text(title) |
|
103
|
.foregroundStyle(Color.controlKitCream.opacity(0.62)) |
|
104
|
Spacer() |
|
105
|
Text(value) |
|
106
|
.fontWeight(.semibold) |
|
107
|
} |
|
108
|
} |
|
109
|
} |
|
110
|
|
|
111
|
private extension Color { |
|
112
|
static let controlKitGreen = Color(red: 0.106, green: 0.263, blue: 0.196) |
|
113
|
static let controlKitCream = Color(red: 0.961, green: 0.953, blue: 0.925) |
|
114
|
} |