feature/xcodegen-modernize-runner
swift 99 lines 3.46 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 .frame(minWidth: 640, minHeight: 480)
48 }
49
50 private var logo: some View {
51 Text("XC\nRS")
52 .font(.system(size: 30, weight: .black, design: .rounded))
53 .multilineTextAlignment(.center)
54 .lineSpacing(-8)
55 .foregroundStyle(Color.controlKitGreen)
56 .frame(width: 96, height: 96)
57 .background(Color.controlKitCream, in: RoundedRectangle(cornerRadius: 24))
58 }
59
60 private var statusCard: some View {
61 VStack(alignment: .leading, spacing: 14) {
62 Label("Runner online", systemImage: "checkmark.circle.fill")
63 .font(.headline)
64 .foregroundStyle(.green)
65 Text("The XCTest host is ready to receive ControlKit automation requests.")
66 .foregroundStyle(.secondary)
67 }
68 .padding(22)
69 .frame(maxWidth: .infinity, alignment: .leading)
70 .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 20))
71 }
72
73 private var informationCard: some View {
74 VStack(alignment: .leading, spacing: 16) {
75 infoRow(title: "Project", value: "XCRSControlKit")
76 infoRow(title: "Creator", value: "smbCloud")
77 infoRow(title: "Platform", value: "macOS")
78 infoRow(title: "Purpose", value: "Native pointer and keyboard automation runner")
79 }
80 .padding(22)
81 .frame(maxWidth: .infinity, alignment: .leading)
82 .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 20))
83 }
84
85 private func infoRow(title: String, value: String) -> some View {
86 HStack {
87 Text(title)
88 .foregroundStyle(.secondary)
89 Spacer()
90 Text(value)
91 .fontWeight(.semibold)
92 }
93 }
94 }
95
96 private extension Color {
97 static let controlKitGreen = Color(red: 0.106, green: 0.263, blue: 0.196)
98 static let controlKitCream = Color(red: 0.961, green: 0.953, blue: 0.925)
99 }