NOTE: This sample code is taken from the article by Frank Jia in his article titled Build a Custom iOS Segmented Control With SwiftUI published on Medium at https://betterprogramming.pub/custom-ios-segmented-control-with-swiftui-473b386d0b51
I have made only minor modifications to the code to make it compatible as a Swift Package, I make no claim to the code, I am using it only as an example for my tutorial.
The author, Frank Jia has kindly given his permission to use this code for my example and I encourage you to follow him on Medium and read his other posts.
This Swift Package is used in the tutorial I created and is posted on YouTube to show you you how to clone and modify a Swift Package for your own use.
Please see the full video and documentation - https://stewartlynch.github.io/SegmentedPicker/