DialStylePicker

0.1.1

A SwiftUI dial-style segmented picker for iOS.
noppefoxwolf/DialStylePicker

What's New

0.1.1

2026-06-27T16:02:34Z

What's Changed

  • Fix indicator vertical alignment coordinate conversion.
  • Update example GIF.

DialStylePicker

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.

DialStylePicker example

Requirements

  • iOS 18.0+
  • Swift 6.3+
  • Xcode with Swift Package Manager support

Installation

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.

Usage

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")
        }
    }
}

Grouped Segments

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.

Example

An example Swift package is included in Example.swiftpm.

open Example.swiftpm

Testing

Run 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.

License

DialStylePicker is available under the MIT license. See LICENSE for details.

Description

  • Swift Tools 6.3.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Jun 27 2026 10:01:33 GMT-0900 (Hawaii-Aleutian Daylight Time)