I can't seem to get the SwiftUI TabView images to work on macOS, no matter what I try. I've tried different images, image sizes, etc. I've also swapped the Image/Text order in the .tabItem, and tried wrapping it in a VStack/Group.
Are they just not working?
struct PlaygroundView: View {
@State private var selectedTab: Int = 0
var body: some View {
TabView(selection: $selectedTab) {
Text("Tab 1 contents")
.tag(0)
.tabItem {
Image(nsImage: NSImage(named: NSImage.goLeftTemplateName)!)
Text("Tab 1")
}
Text("Tab 2 contents")
.tag(1)
.tabItem {
Image(nsImage: NSImage(named: NSImage.goRightTemplateName)!)
Text("Tab 2")
}
}
}
}