Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add settings view for Xcode chat proxy
  • Loading branch information
intitni committed Oct 21, 2025
commit ae59139dbb1c5384ba196164bfdccac18ba56fc7
30 changes: 17 additions & 13 deletions Core/Sources/HostApp/FeatureSettingsView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import SwiftUI
import SharedUIComponents

struct FeatureSettingsView: View {
var tabContainer: ExternalTabContainer {
ExternalTabContainer.tabContainer(for: "Features")
}

@State var tag = 0

var body: some View {
Expand Down Expand Up @@ -40,18 +45,18 @@ struct FeatureSettingsView: View {
subtitle: "Xcode related features",
image: "app"
)

// #if canImport(ProHostApp)
// ScrollView {
// TerminalSettingsView().padding()
// }
// .sidebarItem(
// tag: 3,
// title: "Terminal",
// subtitle: "Terminal chat tab",
// image: "terminal"
// )
// #endif
ForEach(Array(tabContainer.tabs.enumerated()), id: \.1.id) { index, tab in
ScrollView {
tab.viewBuilder().padding()
}
.sidebarItem(
tag: 4 + index,
title: tab.title,
subtitle: tab.description,
image: tab.image
)
}
}
}
}
Expand All @@ -62,4 +67,3 @@ struct FeatureSettingsView_Previews: PreviewProvider {
.frame(width: 800)
}
}

14 changes: 13 additions & 1 deletion Tool/Sources/SharedUIComponents/TabContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ public final class ExternalTabContainer {
public struct TabItem: Identifiable {
public var id: String
public var title: String
public var description: String
public var image: String
public let viewBuilder: () -> AnyView

public init<V: View>(
id: String,
title: String,
description: String = "",
image: String = "",
@ViewBuilder viewBuilder: @escaping () -> V
) {
self.id = id
self.title = title
self.description = description
self.image = image
self.viewBuilder = { AnyView(viewBuilder()) }
}
Expand Down Expand Up @@ -46,22 +49,31 @@ public final class ExternalTabContainer {
public func registerTab<V: View>(
id: String,
title: String,
description: String = "",
image: String = "",
@ViewBuilder viewBuilder: @escaping () -> V
) {
tabs.append(TabItem(id: id, title: title, image: image, viewBuilder: viewBuilder))
tabs.append(TabItem(
id: id,
title: title,
description: description,
image: image,
viewBuilder: viewBuilder
))
}

public static func registerTab<V: View>(
for tabContainerId: String,
id: String,
title: String,
description: String = "",
image: String = "",
@ViewBuilder viewBuilder: @escaping () -> V
) {
tabContainer(for: tabContainerId).registerTab(
id: id,
title: title,
description: description,
image: image,
viewBuilder: viewBuilder
)
Expand Down