Offers a seamless integration of a segmented control and a page view in native SwiftUI applications. Users can navigate between pages by swiping or tapping on segments in the control. Compatible with iOS 13+ and visionOS 1+.

The following example shows a possible onboarding process. The segmented control has three segments with the labels Welcome, Features, and Next Steps that correspond to three custom SwiftUI views: WelcomeView(), FeaturesView(), and NextStepsView().
import SegmentedControlPageView @State var currentSelection: Int = 0 SegmentedControlPageView( "Onboarding Process", selection: $currentSelection, labels: [ "Welcome", "Features", "Next Steps" ], pages: [ WelcomeView(), FeaturesView(), NextStepsView() ] )If you'd like to use the page view without the segmented control, initialize a PageView in your project. This will fall back to a UIKit implementation for older versions of iOS, to ensure consistency on all versions.
PageView([ WelcomeView(), FeaturesView(), NextStepsView() ], selection: $currentSelection)- iOS 13.0 or later
- visionOS 1.0 or later
In Xcode go to Project -> Your Project Name -> Package Dependencies -> Tap Plus. Insert url:
https://github.com/samdawes/SegmentedControlPageView or add it to the dependencies section in your Package.swift file:
dependencies: [ .package(url: "https://github.com/samdawes/SegmentedControlPageView", .upToNextMajor(from: "1.0.0")) ]If you prefer not to use Swift Package Manager, you can integrate manually. Put the Sources/SegmentedControlPageView folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.
If your app uses SegmentedControlPageView, don't hesitate to add yours to the list!