-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathCopilotIntroView.swift
More file actions
110 lines (98 loc) · 3.68 KB
/
CopilotIntroView.swift
File metadata and controls
110 lines (98 loc) · 3.68 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
import SwiftUI
import Perception
import SharedUIComponents
struct CopilotIntroView: View {
var body: some View {
WithPerceptionTracking {
VStack(alignment: .center, spacing: 8) {
CopilotIntroItemView(
imageName: "CopilotLogo",
title: "Agent Mode",
description: "Activate Agent Mode to handle multi-step coding tasks with Copilot."
)
CopilotIntroItemView(
systemImage: "wrench.and.screwdriver",
title: "MCP Support",
description: "Connect to MCP to extend your Copilot with custom tools and services for advanced workflows."
)
CopilotIntroItemView(
imageName: "ChatIcon",
title: "Ask Mode",
description: "Use Ask Mode to chat with Copilot to understand, debug, or improve your code."
)
CopilotIntroItemView(
systemImage: "option",
title: "Code Suggestions",
description: "Get smart code suggestions in Xcode. Press Tab ⇥ to accept a code suggestion, or Option ⌥ to see more alternatives."
)
}
.padding(0)
.frame(maxWidth: .infinity, alignment: .center)
}
}
}
struct CopilotIntroItemView: View {
let image: Image
let title: String
let description: String
public init(imageName: String, title: String, description: String) {
self.init(
imageObject: Image(imageName),
title: title,
description: description
)
}
public init(systemImage: String, title: String, description: String) {
self.init(
imageObject: Image(systemName: systemImage),
title: title,
description: description
)
}
public init(imageObject: Image, title: String, description: String) {
self.image = imageObject
self.title = title
self.description = description
}
var body: some View {
WithPerceptionTracking {
VStack(alignment: .leading, spacing: 0){
HStack(alignment: .center, spacing: 8) {
image
.resizable()
.renderingMode(.template)
.scaledToFill()
.frame(width: 12, height: 12)
.foregroundColor(.primary)
.padding(.leading, 8)
Text(title)
.kerning(0.096)
.scaledFont(.body)
.multilineTextAlignment(.center)
.foregroundColor(.primary)
}
.frame(maxWidth: .infinity, alignment: .leading)
Text(description)
.scaledFont(.body)
.foregroundColor(.secondary)
.padding(.leading, 28)
.padding(.top, 4)
.frame(maxWidth: .infinity, alignment: .topLeading)
}
.padding(8)
.frame(maxWidth: 360, alignment: .top)
.background(.primary.opacity(0.1))
.cornerRadius(2)
.overlay(
RoundedRectangle(cornerRadius: 2)
.inset(by: 0.5)
.stroke(lineWidth: 0)
)
}
}
}
struct CopilotIntroView_Previews: PreviewProvider {
static var previews: some View {
CopilotIntroView()
}
}