feature/xcodegen-modernize-runner
swift 98 lines 3.41 KB
Raw
1 import SwiftUI
2
3 @main
4 struct ControlKitRunnerApp: App {
5 var body: some Scene {
6 WindowGroup {
7 ControlKitShowcaseView()
8 }
9 .defaultSize(width: 820, height: 620)
10 }
11 }
12
13 private struct ControlKitShowcaseView: View {
14 private let repositoryURL = URL(string: "https://github.com/ondeinference/xcrs-controlkit")!
15
16 var body: some View {
17 ScrollView {
18 VStack(alignment: .leading, spacing: 28) {
19 HStack(spacing: 18) {
20 logo
21 VStack(alignment: .leading, spacing: 4) {
22 Text("ControlKit")
23 .font(.system(size: 40, weight: .bold, design: .rounded))
24 Text("Apple platform automation")
25 .font(.title3)
26 .foregroundStyle(.secondary)
27 }
28 }
29
30 Text("A clean-room runner for reliable black-box testing across Apple platforms.")
31 .font(.title2.weight(.medium))
32 .fixedSize(horizontal: false, vertical: true)
33
34 statusCard
35 informationCard
36
37 Link(destination: repositoryURL) {
38 Label("View project on GitHub", systemImage: "arrow.up.right")
39 .font(.headline)
40 .frame(maxWidth: .infinity)
41 }
42 .buttonStyle(.borderedProminent)
43 }
44 .padding(40)
45 .frame(maxWidth: 760, alignment: .leading)
46 }
47 }
48
49 private var logo: some View {
50 Text("XC\nRS")
51 .font(.system(size: 30, weight: .black, design: .rounded))
52 .multilineTextAlignment(.center)
53 .lineSpacing(-8)
54 .foregroundStyle(Color.controlKitGreen)
55 .frame(width: 96, height: 96)
56 .background(Color.controlKitCream, in: RoundedRectangle(cornerRadius: 24))
57 }
58
59 private var statusCard: some View {
60 VStack(alignment: .leading, spacing: 14) {
61 Label("Runner online", systemImage: "checkmark.circle.fill")
62 .font(.headline)
63 .foregroundStyle(.green)
64 Text("The XCTest host is ready to receive ControlKit automation requests.")
65 .foregroundStyle(.secondary)
66 }
67 .padding(22)
68 .frame(maxWidth: .infinity, alignment: .leading)
69 .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 20))
70 }
71
72 private var informationCard: some View {
73 VStack(alignment: .leading, spacing: 16) {
74 infoRow(title: "Project", value: "XCRSControlKit")
75 infoRow(title: "Creator", value: "smbCloud")
76 infoRow(title: "Platform", value: "visionOS")
77 infoRow(title: "Purpose", value: "Native spatial automation runner")
78 }
79 .padding(22)
80 .frame(maxWidth: .infinity, alignment: .leading)
81 .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 20))
82 }
83
84 private func infoRow(title: String, value: String) -> some View {
85 HStack {
86 Text(title)
87 .foregroundStyle(.secondary)
88 Spacer()
89 Text(value)
90 .fontWeight(.semibold)
91 }
92 }
93 }
94
95 private extension Color {
96 static let controlKitGreen = Color(red: 0.106, green: 0.263, blue: 0.196)
97 static let controlKitCream = Color(red: 0.961, green: 0.953, blue: 0.925)
98 }