I'm trying to pass a view into a struct for creating a tab which is the following code:
struct TabItem: TabView {
var tabView: View
var tabText: String
var tabIcon: String
var body: some View {
self.tabView.tabItem {
Text(self.tabText)
Image(systemName: self.tabIcon)
}
}
}
struct ContentView: View {
var body: some View {
NavigationView {
TabView {
TabItem(tabView: SimpleCalculatorView(), tabText: "Home", tabIcon: "house")
}
}
}
}
The error I'm getting is the following:
Protocol 'View' can only be used as a generic constraint because it has Self or associated type requirements