reports
reports copied to clipboard
FB13659840: Unable to add a color(tintColor) to each TabItem in the TabView.
- Date: 2024-2-28
- Resolution: Open
- Area: SwiftUI
- OS: iOS
- Type: Incorrect/Unexpected Behavior
- Keywords: SwiftUI, TabView
Details
Unable to add a color(tintColor) to each TabItem in the TabView.
enum TabItem: String, CaseIterable {
case first
case second
case third
var tabColor: Color {
switch self {
case .first: .red
case .second: .blue
case .third: .green
}
}
}
struct TestView: View {
var body: some View {
TabView {
ForEach(TabItem.allCases, id: \.self) { tab in
Text(tab.rawValue)
.tabItem {
Label(tab.rawValue, systemImage: "bird")
.tint(tab.tabColor)
}
}
}
.tint(.yellow)
}
}