SwiftUI - How Can I Create a Stack Picker in WatchOS like the Podcasts App?

Viewed 131

I am trying to create a stack picker like the one in the Podcasts app on WatchOS. If you go to the Apple Human Interface Guidelines here,the "Stack picker" is what I am referring to. But I was not able to find docs anywhere on how to create it.

The only demo I was able to find is here: https://bignerdranch.com/blog/watchkit-2-hardware-bits-using-the-digital-crown/

It says that you need to "switch the code to return image-based picker items. ", which I have attempted here:

var cardsPicker: some View {
    VStack {
        Picker(selection: self.$selectedCardIndex, label: Text("")){
            ForEach(1..<ImagesArray.count){ i in
                Image(imagesArray[i])
                    .resizable()
                    .aspectRatio(contentMode: .fit)
                    .scaledToFill()
            }
        }
        .focusBorderHidden()
        .scaledToFill()
    }
}

Here is the result for me:

enter image description here

What I am trying to achieve is an image scrolling that is more like this:

enter image description here

0 Answers
Related