Swift package · v0.1.2
KLGlassSegments
Use navigation-style segmented controls across native glass and material fallback paths.
SwiftUI and UIKit segmented controls with generic selection identity, reselect callbacks, drag cancellation, accessibility identifiers, and Reduce Motion handling. Native glass is used where iOS provides it.
Functions
- Binding-driven SwiftUI and UIControl-based UIKit APIs
- Stable selection across refreshed generic segment IDs
- Reselect, drag cancellation, and VoiceOver activation
- Native iOS glass with a material fallback
Not included
It renders and manages segmented-control interaction. Navigation state, haptics policy, application content, and product-specific styling remain with the integrating application.
Install with SwiftPM
.package(url: "https://github.com/KoenLee1023/KLGlassSegments.git", from: "0.1.2")Usage
KLGlassSegmentedControl(
segments: segments,
selection: $selection,
floatingAction: composeAction
)API documentation
Open the complete API documentation.KLGlassSegmentedControlThe SwiftUI control binds a selected ID and accepts segments, style, metrics, an optional action, and an optional reselect callback.
KLGlassSegmentedUIKitControlThe UIKit control accepts refreshed segments, applies external selection, and dispatches .valueChanged for committed changes.
KLGlassSegmentDescribes one generic-ID item with title, SF Symbols, optional selected tint, accessibility identifier, and UIKit images where available.
Demo apps
GlassNavigation
Demonstrates selection, reselect, a floating action, and the fallback presentation.
SegmentGallery
Shows style, metrics, Reduce Motion, and accessibility-oriented control variations.