@@ -26,6 +26,9 @@ public protocol ChatTabType {
2626 /// Build the tabItem for this chat tab.
2727 @ViewBuilder
2828 func buildTabItem( ) -> any View
29+ /// Build the icon for this chat tab.
30+ @ViewBuilder
31+ func buildIcon( ) -> any View
2932 /// Build the menu for this chat tab.
3033 @ViewBuilder
3134 func buildMenu( ) -> any View
@@ -88,7 +91,7 @@ open class BaseChatTab {
8891 /// The tab item for this chat tab.
8992 @ViewBuilder
9093 public var tabItem : some View {
91- let id = " ChatTabMenu \( id) "
94+ let id = " ChatTabTab \( id) "
9295 if let tab = self as? ( any ChatTabType ) {
9396 ContentView ( buildView: tab. buildTabItem) . id ( id)
9497 . onAppear {
@@ -99,6 +102,17 @@ open class BaseChatTab {
99102 }
100103 }
101104
105+ /// The icon for this chat tab.
106+ @ViewBuilder
107+ public var icon : some View {
108+ let id = " ChatTabIcon \( id) "
109+ if let tab = self as? ( any ChatTabType ) {
110+ ContentView ( buildView: tab. buildIcon) . id ( id)
111+ } else {
112+ EmptyView ( ) . id ( id)
113+ }
114+ }
115+
102116 /// The tab item for this chat tab.
103117 @ViewBuilder
104118 public var menu : some View {
@@ -183,6 +197,10 @@ public class EmptyChatTab: ChatTab {
183197 Text ( " Empty- \( id) " )
184198 }
185199
200+ public func buildIcon( ) -> any View {
201+ Image ( systemName: " square " )
202+ }
203+
186204 public func buildMenu( ) -> any View {
187205 Text ( " Empty- \( id) " )
188206 }
0 commit comments