forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTabView.swift
More file actions
52 lines (49 loc) · 1.76 KB
/
TabView.swift
File metadata and controls
52 lines (49 loc) · 1.76 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
import SwiftUI
struct TabView: View {
@ObservedObject var panelViewModel: SuggestionPanelViewModel
var body: some View {
Group {
switch panelViewModel.activeTab {
case .chat:
if panelViewModel.content != nil {
Button(action: {
panelViewModel.activeTab = .suggestion
}, label: {
Image(systemName: "lightbulb.fill")
.frame(width: Style.widgetWidth, height: Style.widgetHeight)
.background(
Color.userChatContentBackground,
in: Circle()
)
})
.buttonStyle(.plain)
}
case .suggestion:
if panelViewModel.chat != nil {
Button(action: {
panelViewModel.activeTab = .chat
}, label: {
Image(systemName: "ellipsis.bubble.fill")
.frame(width: Style.widgetWidth, height: Style.widgetHeight)
.background(
Color.userChatContentBackground,
in: Circle()
)
})
.buttonStyle(.plain)
}
}
}
.opacity(panelViewModel.isPanelDisplayed ? 1 : 0)
.preferredColorScheme(panelViewModel.colorScheme)
}
}
struct TabView_Preview: PreviewProvider {
static var previews: some View {
VStack {
TabView(panelViewModel: .init())
}
.frame(width: 30)
.background(Color.black)
}
}