I'm trying to put a view inside of SegmentedPickerStyle Picker.
The view I'm trying to put is just simple like this:
VStack{
Text("text1")
Text("text1")
}
And below are what I have tried to achieve this
try1
struct ContentView: View {
@State private var selected = 0
let options = ["AAA", "BBB"]
var body: some View {
Picker(selection: self.$selected, label: Text("")) {
ForEach(0..<self.options.count) {number in
VStack{
Text("\(self.options[number])")
Text("some text")
}
}
}.pickerStyle(SegmentedPickerStyle())
}
}
try2
struct ContentView: View {
@State private var selected = 0
let options = ["AAA", "BBB"]
var body: some View {
Picker(selection: self.$selected, label: Text("")) {
ForEach(0..<self.options.count) {number in
Text("""
\(self.options[number])
some text
""")
}
}.pickerStyle(SegmentedPickerStyle())
}
}
But above both ways don't produce the result I want, Would be there anyway to achieve this?