A radial menu (pie menu / fan menu) for SwiftUI, built on iOS 26 Liquid Glass. Hold a button, the actions fan out under your thumb, slide onto one and release — a press-drag-release gesture that selects in one motion.
Hold the hub button and the fan slides out from behind it as one glass blob that splits apart. Slide your thumb toward an item and release — one gesture, no second tap. Or tap the hub to keep the fan open and pick by tapping. Use it anywhere a floating action button hides too many actions behind a second screen: quick-start menus, compose buttons, mode switchers.
- Two interaction modes: press → drag → release, and tap → tap
- Angle-based selection — overshooting far past the buttons keeps the selection, so it's forgiving mid-workout, mid-commute, one-handed
- Liquid Glass morphing: the buttons share one
GlassEffectContainer, so the closed fan is a single blob that the hub visually emits - Haptics, staggered springs, labels that stay out of the buttons' way
- Up to 8 items; geometry adapts (140° span cap, radius from screen width)
- Pure SwiftUI, zero dependencies
- iOS 26+ (uses
glassEffect/GlassEffectContainer) - Swift 6
Swift Package Manager:
.package(url: "https://github.com/ny000815/GlassFan", from: "0.1.0")import GlassFan
struct ContentView: View {
var body: some View {
RadialMenu(actions: [
RadialAction(title: "Push", systemImage: "figure.strengthtraining.traditional") { start(.push) },
RadialAction(title: "Pull", systemImage: "figure.rower") { start(.pull) },
RadialAction(title: "Legs", systemImage: "figure.walk") { start(.legs) },
RadialAction(title: "Timer", systemImage: "timer", tint: .orange) { startTimer() },
]) {
MyScreen() // your content
} hub: {
ZStack { // the button the fan grows out of
Circle().fill(.green)
Image(systemName: "plus").foregroundStyle(.white)
}
}
}
}RadialMenu places the hub at the bottom center. If your hub lives inside a
custom tab bar, wire the primitives yourself — RadialMenuTrigger (the
gesture area), RadialMenuLayer (the full-screen fan), and RadialMenuState
are all public; the container's source shows the complete dance, including
the close choreography (fold to center → circle descends onto the hub).
A few things that were harder than they look, preserved as comments in the source:
- Selection is by angle, not distance. A drag that overshoots the ring should keep its selection; only the dead zone near the center cancels.
- Highlight resizes the circle, not
scaleEffect. Scaling a glass circle desyncs the glass shape from its icon and the icon drifts off-center. - The folded stack hides behind the hub. The hub is drawn frontmost and the buttons interpolate from the hub's current position, so opening reads as "the button emits the fan" instead of "buttons teleport in".
DragGestureemits nothing until the finger moves, so a held-still finger must still open the fan — the long-press branch handlesdrag == nil.
GlassFan is the start menu in LiftDiff, a free strength-training log (that's the GIF above).
MIT