Reputation: 9703
I have a picker with segmentedPickerStyle and I want each section to have text and a small image. The problem is with the approach below I get 4 segments instead of 2. One for each text and one for each image. Is there any way to have the text and image together in one segment using only swiftui. I know I can create an image with text in the image but was wondering if there is a pure swiftUI way to do this using Text and Image
Picker(selection: $pickerSelection, label: Text("choose")) {
HStack {
Text("One")
Image("firstImage")
}
.tag(0)
HStack {
Text("Two")
Image("secondImage")
}
.tag(1)
}
.pickerStyle(SegmentedPickerStyle())
Upvotes: 2
Views: 494