Skip to content
ny000815Public

About

Press-drag-release radial menu for SwiftUI, built on iOS 26 Liquid Glass

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

GlassFan

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.

Swift versions Platforms iOS 26+ License: MIT

Holding the start button opens a fan of glass buttons; sliding the thumb highlights an item and releasing launches it

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

Requirements

  • iOS 26+ (uses glassEffect / GlassEffectContainer)
  • Swift 6

Installation

Swift Package Manager:

.package(url: "https://github.com/ny000815/GlassFan", from: "0.1.0")

Quick start

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

Notes from building it

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".
  • DragGesture emits nothing until the finger moves, so a held-still finger must still open the fan — the long-press branch handles drag == nil.

Used in

GlassFan is the start menu in LiftDiff, a free strength-training log (that's the GIF above).

License

MIT

About

Press-drag-release radial menu for SwiftUI, built on iOS 26 Liquid Glass

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages