
SwiftUI has a PickerStyle called SegmentedPickerStyle, but it doesn’t let you customize it. So I will show you how to make a custom one that doesn’t use GeometryReader or ZStacks, those are confusing and difficult.
Demo: https://imgur.com/a/NsexCm2
I put comments in there. Hope this helps you avoid using GeometryReader or ZStack unless it’s actually necessary!
Here is a link to the code in a githubgist:
https://gist.github.com/michael94ellis/5a46a5c2983da0cc99692b6659876fce