forked from github/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstructions.swift
More file actions
39 lines (34 loc) · 1.07 KB
/
Instructions.swift
File metadata and controls
39 lines (34 loc) · 1.07 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
import ComposableArchitecture
import Foundation
import MarkdownUI
import SwiftUI
struct Instruction: View {
let chat: StoreOf<Chat>
var body: some View {
WithPerceptionTracking {
Group {
Markdown(
"""
Hello, I am your AI programming assistant. I can identify issues, explain and even improve code.
"""
)
.modifier(InstructionModifier())
}
}
}
struct InstructionModifier: ViewModifier {
@AppStorage(\.chatFontSize) var chatFontSize
func body(content: Content) -> some View {
content
.textSelection(.enabled)
.markdownTheme(.instruction(fontSize: chatFontSize))
.opacity(0.8)
.frame(maxWidth: .infinity, alignment: .leading)
.padding()
.overlay {
RoundedRectangle(cornerRadius: 8)
.stroke(Color(nsColor: .separatorColor), lineWidth: 1)
}
}
}
}