Skip to content

Commit ae59139

Browse files
committed
Add settings view for Xcode chat proxy
1 parent adb332f commit ae59139

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

Core/Sources/HostApp/FeatureSettingsView.swift

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import SwiftUI
2+
import SharedUIComponents
23

34
struct FeatureSettingsView: View {
5+
var tabContainer: ExternalTabContainer {
6+
ExternalTabContainer.tabContainer(for: "Features")
7+
}
8+
49
@State var tag = 0
510

611
var body: some View {
@@ -40,18 +45,18 @@ struct FeatureSettingsView: View {
4045
subtitle: "Xcode related features",
4146
image: "app"
4247
)
43-
44-
// #if canImport(ProHostApp)
45-
// ScrollView {
46-
// TerminalSettingsView().padding()
47-
// }
48-
// .sidebarItem(
49-
// tag: 3,
50-
// title: "Terminal",
51-
// subtitle: "Terminal chat tab",
52-
// image: "terminal"
53-
// )
54-
// #endif
48+
49+
ForEach(Array(tabContainer.tabs.enumerated()), id: \.1.id) { index, tab in
50+
ScrollView {
51+
tab.viewBuilder().padding()
52+
}
53+
.sidebarItem(
54+
tag: 4 + index,
55+
title: tab.title,
56+
subtitle: tab.description,
57+
image: tab.image
58+
)
59+
}
5560
}
5661
}
5762
}
@@ -62,4 +67,3 @@ struct FeatureSettingsView_Previews: PreviewProvider {
6267
.frame(width: 800)
6368
}
6469
}
65-

Tool/Sources/SharedUIComponents/TabContainer.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ public final class ExternalTabContainer {
88
public struct TabItem: Identifiable {
99
public var id: String
1010
public var title: String
11+
public var description: String
1112
public var image: String
1213
public let viewBuilder: () -> AnyView
1314

1415
public init<V: View>(
1516
id: String,
1617
title: String,
18+
description: String = "",
1719
image: String = "",
1820
@ViewBuilder viewBuilder: @escaping () -> V
1921
) {
2022
self.id = id
2123
self.title = title
24+
self.description = description
2225
self.image = image
2326
self.viewBuilder = { AnyView(viewBuilder()) }
2427
}
@@ -46,22 +49,31 @@ public final class ExternalTabContainer {
4649
public func registerTab<V: View>(
4750
id: String,
4851
title: String,
52+
description: String = "",
4953
image: String = "",
5054
@ViewBuilder viewBuilder: @escaping () -> V
5155
) {
52-
tabs.append(TabItem(id: id, title: title, image: image, viewBuilder: viewBuilder))
56+
tabs.append(TabItem(
57+
id: id,
58+
title: title,
59+
description: description,
60+
image: image,
61+
viewBuilder: viewBuilder
62+
))
5363
}
5464

5565
public static func registerTab<V: View>(
5666
for tabContainerId: String,
5767
id: String,
5868
title: String,
69+
description: String = "",
5970
image: String = "",
6071
@ViewBuilder viewBuilder: @escaping () -> V
6172
) {
6273
tabContainer(for: tabContainerId).registerTab(
6374
id: id,
6475
title: title,
76+
description: description,
6577
image: image,
6678
viewBuilder: viewBuilder
6779
)

0 commit comments

Comments
 (0)