DialStylePicker is a SwiftUI picker that behaves like a compact dial-style segmented control. It centers the selected item, expands while scrolling, supports tagged SwiftUI content, and can group adjacent segments into a shared selection frame.
On iOS 26 and later it uses SwiftUI's glass effect. On earlier supported systems it falls back to a capsule-shaped secondary background.
- iOS 18.0+
- Swift 6.3+
- Xcode with Swift Package Manager support
Add this package to your app with Swift Package Manager:
dependencies: [
.package(url: "https://github.com/noppefoxwolf/DialStylePicker.git", from: "0.1.0")
]Then add DialStylePicker to your target dependencies.
Import the package and bind the picker to a tagged selection value.
import SwiftUI
import DialStylePicker
struct ContentView: View {
@State private var selection = "photo"
var body: some View {
DialStylePicker(selection: $selection) {
Text("Video")
.tag("video")
Text("Photo")
.tag("photo")
Text("Portrait")
.tag("portrait")
}
}
}Use dialStylePickerGroup(_:) when multiple adjacent segments should share one background frame while still keeping their own tags.
DialStylePicker(selection: $selection) {
Text("Video")
.tag("video")
.dialStylePickerGroup("capture")
Text("Photo")
.tag("photo")
.dialStylePickerGroup("capture")
Text("Portrait")
.tag("portrait")
}Segments with the same group id are measured as one visual group for the focused background and scroll target.
An example Swift package is included in Example.swiftpm.
open Example.swiftpmRun tests with xcodebuild against an iOS Simulator destination:
xcodebuild test \
-scheme DialStylePicker \
-destination 'platform=iOS Simulator,name=iPhone 17,OS=26.5'To verify that the test bundle builds without running it:
xcodebuild build-for-testing \
-scheme DialStylePicker \
-destination 'platform=iOS Simulator,name=iPhone 17,OS=26.5'swift test builds the package for macOS by default, so it is not suitable for this iOS-only package.
DialStylePicker is available under the MIT license. See LICENSE for details.
