How to resize the rows in a Picker?

93 Views Asked by At

I’m currently switching over my app from interface builder to SwiftUI. I transferred a horizontal UIPickerview over to SwiftUI and it works pretty much the same if not better than before.

Problem: The content (Images) inside the picker view is significantly smaller than before.

Question: Is it possible to resize the rows in a picker to make the images bigger?

Here is my horizontal picker with images as content.

@State private var data = UserDefaults.standard.integer(forKey: “DataIndex")
var images = [“example”, “example”, …]

Picker(selection: $data, label: Text(“Data”)) {
    ForEach(images, id: \.self) { image in
        Image(image)
        .resizable()
        .scaledToFit()
        .rotationEffect(Angle(degrees: 90))
    }
}
.labelsHidden()
.rotationEffect(Angle(degrees: -90))
.frame(maxHeight: 100)
.clipped()
0

There are 0 best solutions below